Skip to content

Commit

Permalink
rename the value of KIVY_EVENTLOOP from 'async' to 'asyncio'
Browse files Browse the repository at this point in the history
  • Loading branch information
gottadiveintopython committed Jul 7, 2019
1 parent b8f7a23 commit 578f1da
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/sources/guide/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ KIVY_EVENTLOOP

``'sync'``: When the app is run normally in a synchronous manner.
The default if not set.
``'async'``: When the app is run in an asynchronous manner and the standard
``'asyncio'``: When the app is run in an asynchronous manner and the standard
library asyncio package should be used.
``'trio'``: When the app is run in an asynchronous manner and the `trio`
package should be used.
Expand Down
4 changes: 2 additions & 2 deletions examples/async/asyncio_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import asyncio
import os

os.environ['KIVY_EVENTLOOP'] = 'async'
'''async needs to be set so that asyncio will be used for the event loop. '''
os.environ['KIVY_EVENTLOOP'] = 'asyncio'
'''asyncio needs to be set so that asyncio will be used for the event loop.'''

from kivy.app import App
from kivy.lang.builder import Builder
Expand Down
4 changes: 2 additions & 2 deletions examples/async/asyncio_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import asyncio
import os

os.environ['KIVY_EVENTLOOP'] = 'async'
'''async needs to be set so that asyncio will be used for the event loop. '''
os.environ['KIVY_EVENTLOOP'] = 'asyncio'
'''asyncio needs to be set so that asyncio will be used for the event loop.'''

from kivy.app import async_runTouchApp
from kivy.lang.builder import Builder
Expand Down
10 changes: 5 additions & 5 deletions kivy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ def on_resume(self):
The environmental variable ``KIVY_EVENTLOOP`` determines which async library
to use, if at all. It can be set to one of `"sync"` when it should be run
synchronously like a normal app, `"async"` when the standard library `asyncio`
should be used, or `"trio"` if the trio library should be used. If not set it
defaults to `"sync"`.
synchronously like a normal app, `"asyncio"` when the standard library
`asyncio` should be used, or `"trio"` if the trio library should be used.
If not set it defaults to `"sync"`.
In the `"async"` or `"trio"` case, one schedules :func:`async_runTouchApp` or
In the `"asyncio"` or `"trio"` case, one schedules :func:`async_runTouchApp` or
:meth:`App.async_run` to run within the given library's async event loop as in
the examples shown below. Kivy is then treated as just another coroutine that
the given library runs in its event loop.
Expand All @@ -358,7 +358,7 @@ def on_resume(self):
import asyncio
import os
os.environ['KIVY_EVENTLOOP'] = 'async'
os.environ['KIVY_EVENTLOOP'] = 'asyncio'
from kivy.app import async_runTouchApp
from kivy.uix.label import Label
Expand Down
10 changes: 5 additions & 5 deletions kivy/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def my_callback(dt):
block while idling.
This is selected with the `KIVY_EVENTLOOP` environmental variable and it
can be one of `"sync"` when it should be run synchronously, `"async"` when
can be one of `"sync"` when it should be run synchronously, `"asyncio"` when
the standard library `asyncio` should be used, or `"trio"` if the trio library
should be used. If not set it defaults to `"sync"`.
Expand Down Expand Up @@ -486,7 +486,7 @@ class ClockBaseBehavior(object):
`async_lib`: string
The async library to use when the clock is run asynchronously.
Can be one of `"sync"` when it's run synchronously,
`"async"` when the standard library asyncio should be used, or
`"asyncio"` when the standard library asyncio should be used, or
`"trio"` if the trio library should be used. It defaults to
`"sync"`.
'''
Expand Down Expand Up @@ -537,8 +537,8 @@ def _init_asyncio(self, lib):
`lib`: string
The async library to use when the clock is run asynchronously.
Can be one of `"sync"` when it's run synchronously,
`"async"` when the standard library asyncio should be used, or
`"trio"` if the trio library should be used.
`"asyncio"` when the standard library asyncio should be used,
or `"trio"` if the trio library should be used.
"""
if lib == 'trio':
import trio
Expand All @@ -549,7 +549,7 @@ async def wait_for(coro, t):
with trio.move_on_after(t):
await coro
self._async_wait_for = wait_for
elif lib == 'async':
elif lib == 'asyncio':
import asyncio
self._async_event_cls = asyncio.Event
self._async_lib = asyncio
Expand Down
4 changes: 2 additions & 2 deletions kivy/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def kivy_app(request, nursery):

try:
import pytest_asyncio
async_lib = 'async'
async_lib = 'asyncio'
except ImportError:
try:
import trio
Expand All @@ -55,7 +55,7 @@ async def kivy_app(request, nursery):

app = request.param[0]()

if async_lib == 'async':
if async_lib == 'asyncio':
loop = asyncio.get_event_loop()
loop.create_task(app.async_run())
else:
Expand Down

0 comments on commit 578f1da

Please sign in to comment.