diff options
| author | Rapptz <[email protected]> | 2018-06-10 18:09:14 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2018-06-10 18:10:00 -0400 |
| commit | f25091efe1281aebe70189c61f9cac405b21a72f (patch) | |
| tree | d0d13dad1a89de9f45845a36ea475098b7a0b494 /docs | |
| parent | Add Message.jump_to_url (diff) | |
| download | discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.tar.xz discord.py-f25091efe1281aebe70189c61f9cac405b21a72f.zip | |
Drop support for Python 3.4 and make minimum version 3.5.2.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api.rst | 26 | ||||
| -rw-r--r-- | docs/faq.rst | 26 | ||||
| -rw-r--r-- | docs/intro.rst | 6 | ||||
| -rw-r--r-- | docs/migrating.rst | 13 |
4 files changed, 16 insertions, 55 deletions
diff --git a/docs/api.rst b/docs/api.rst index 8be772ac..109f78f9 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -93,17 +93,8 @@ to handle it, which defaults to print a traceback and ignoring the exception. .. warning:: All the events must be a |corourl|_. If they aren't, then you might get unexpected - errors. In order to turn a function into a coroutine they must either be ``async def`` - functions or in 3.4 decorated with :func:`asyncio.coroutine`. - - The following two functions are examples of coroutine functions: :: - - async def on_ready(): - pass - - @asyncio.coroutine - def on_ready(): - pass + errors. In order to turn a function into a coroutine they must be ``async def`` + functions. .. function:: on_connect() @@ -1306,22 +1297,11 @@ Some API functions return an "async iterator". An async iterator is something th capable of being used in an `async for <https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statement>`_ statement. -These async iterators can be used as follows in 3.5 or higher: :: +These async iterators can be used as follows: :: async for elem in channel.history(): # do stuff with elem here -If you are using 3.4 however, you will have to use the more verbose way: :: - - iterator = channel.history() # or whatever returns an async iterator - while True: - try: - item = yield from iterator.next() - except discord.NoMoreItems: - break - - # do stuff with item here - Certain utilities make working with async iterators easier, detailed below. .. class:: AsyncIterator diff --git a/docs/faq.rst b/docs/faq.rst index 57daa471..506a4d43 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -15,27 +15,6 @@ Coroutines Questions regarding coroutines and asyncio belong here. -I get a SyntaxError around the word ``async``\! What should I do? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This :exc:`SyntaxError` happens because you're using a Python version lower than 3.5. Python 3.4 uses ``@asyncio.coroutine`` and -``yield from`` instead of ``async def`` and ``await``. - -Thus you must do the following instead: :: - - async def foo(): - await bar() - - # into - - @asyncio.coroutine - def foo(): - yield from bar() - -Don't forget to ``import asyncio`` on the top of your files. - -**It is heavily recommended that you update to Python 3.5 or higher as it simplifies asyncio massively.** - What is a coroutine? ~~~~~~~~~~~~~~~~~~~~~~ @@ -195,11 +174,6 @@ technically in another thread, we must take caution in calling thread-safe opera us, :mod:`asyncio` comes with a :func:`asyncio.run_coroutine_threadsafe` function that allows us to call a coroutine from another thread. -.. warning:: - - This function is only part of 3.5.1+ and 3.4.4+. If you are not using these Python versions then use - ``discord.compat.run_coroutine_threadsafe``. - However, this function returns a :class:`concurrent.Future` and to actually call it we have to fetch its result. Putting all of this together we can do the following: :: diff --git a/docs/intro.rst b/docs/intro.rst index 6a8a4d71..29d9f58a 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -11,9 +11,9 @@ in creating applications that utilise the Discord API. Prerequisites --------------- -discord.py works with Python 3.4.2 or higher. Support for earlier versions of Python -is not provided. Python 2.7 or lower is not supported. Python 3.3 is not supported -due to one of the dependencies (``aiohttp``) not supporting Python 3.3. +discord.py works with Python 3.5.2 or higher. Support for earlier versions of Python +is not provided. Python 2.7 or lower is not supported. Python 3.4 or lower is not supported +due to one of the dependencies (``aiohttp``) not supporting Python 3.4. .. _installing: diff --git a/docs/migrating.rst b/docs/migrating.rst index e9fbf000..6d196d87 100644 --- a/docs/migrating.rst +++ b/docs/migrating.rst @@ -14,6 +14,13 @@ new library. Part of the redesign involves making things more easy to use and natural. Things are done on the :ref:`models <discord_api_models>` instead of requiring a :class:`Client` instance to do any work. +Python Version Change +----------------------- + +In order to make development easier and also to allow for our dependencies to upgrade to allow usage of 3.7 or higher, +the library had to remove support for Python versions lower than 3.5.2, which essentially means that **support for Python 3.4 +is dropped**. + Major Model Changes --------------------- @@ -441,14 +448,14 @@ Prior to v1.0, certain functions like ``Client.logs_from`` would return a differ In v1.0, this change has been reverted and will now return a singular type meeting an abstract concept called :class:`AsyncIterator`. -This allows you to iterate over it like normal in Python 3.5+: :: +This allows you to iterate over it like normal: :: async for message in channel.history(): print(message) -Or turn it into a list for either Python 3.4 or 3.5+: :: +Or turn it into a list: :: - messages = await channel.history().flatten() # use yield from for 3.4! + messages = await channel.history().flatten() for message in messages: print(message) |