-
-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async support optionally using anyio #340
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # mkdocs.yml # pyproject.toml # tests/test_completion/test_completion_install.py # typer/main.py
📝 Docs preview for commit 2aaa798 at: https://62f6276299bc9823f965c724--typertiangolo.netlify.app |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #340 +/- ##
==========================================
+ Coverage 96.24% 99.72% +3.48%
==========================================
Files 280 289 +9
Lines 5942 6609 +667
==========================================
+ Hits 5719 6591 +872
+ Misses 223 18 -205 ☔ View full report in Codecov by Sentry. |
@tiangolo will this reach |
# Conflicts: # pyproject.toml # tests/test_completion/test_completion.py # tests/test_completion/test_completion_install.py # tests/test_completion/test_completion_show.py # typer/main.py
📝 Docs preview for commit 54c908a at: https://1d41a6ff.typertiangolo.pages.dev |
📝 Docs preview for commit aba2b6d at: https://f2d58ec2.typertiangolo.pages.dev |
📝 Docs preview for commit 60c1574 at: https://0f102ae8.typertiangolo.pages.dev |
📝 Docs preview for commit 150fe7a at: https://66f933fb.typertiangolo.pages.dev |
📝 Docs preview for commit 4be4aa4 at: https://f6dd02b2.typertiangolo.pages.dev |
📝 Docs preview for commit e3d9232 at: https://dc8389c6.typertiangolo.pages.dev |
📝 Docs preview for commit c30baef at: https://e5083e4f.typertiangolo.pages.dev |
📝 Docs preview for commit b45e696 at: https://5af393d9.typertiangolo.pages.dev |
📝 Docs preview for commit 1aba3c2 at: https://74e837fb.typertiangolo.pages.dev |
I took a shot at supporting async as discussed in #88 while integrated feedback from the issue #88 and PR #332 . Unlike the existing proposal I decided to support both sync and async commands from the same decorator, as I don't see a reason to use two identical decorator functions.
anyio
is listed as an extra dependency. When anyio is not installed, asyncio is used, Whenanyio
andtrio
are installed, the default engine becomes trio.Other async engines, or customized behavior can be used by providing a custom run function via the
async_runner
parameter to the decorator or Typer instance.