[x] I've run the latest black with default args on new code.
[x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
[x] I've added tests for new code.
[x] I accept that @willmcgugan may be pedantic in the code review.
Description
This pull request adds support for using asyncio.Task as an alternative to threading.Thread to handle live updates.
The main reason for implementing this is that when using __import__('pdb').set_trace() or something similar, the screen keeps getting updated making it impossible to debug. Since __import__('pdb').set_trace() interrupts the event loop, this problem wont happen when using async code to handle the updates. Additionally it seams natural to use the event loop to handle the updates when one is available.
I set the default to determining the refresh method to "auto", which determines the method based on if there is a running event loop.
Type of changes
Checklist
Description
This pull request adds support for using asyncio.Task as an alternative to threading.Thread to handle live updates. The main reason for implementing this is that when using
__import__('pdb').set_trace()
or something similar, the screen keeps getting updated making it impossible to debug. Since__import__('pdb').set_trace()
interrupts the event loop, this problem wont happen when using async code to handle the updates. Additionally it seams natural to use the event loop to handle the updates when one is available. I set the default to determining the refresh method to"auto"
, which determines the method based on if there is a running event loop.