Skip to content
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

✨ Add support for Trio via AnyIO #3372

Merged
merged 24 commits into from Oct 6, 2021
Merged

Conversation

graingert
Copy link
Contributor

Fixes #310

see also encode/starlette#1157

fastapi/concurrency.py Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@graingert
Copy link
Contributor Author

graingert commented Jun 26, 2021

currently blocked on encode/starlette#1210

@graingert
Copy link
Contributor Author

@tiangolo can you enable my CI builds?

pyproject.toml Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 19, 2021

Codecov Report

Merging #3372 (7c19efb) into master (4d26fa5) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #3372   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          410       409    -1     
  Lines        10281     10264   -17     
=========================================
- Hits         10281     10264   -17     
Impacted Files Coverage Δ
docs_src/async_tests/test_main.py 100.00% <100.00%> (ø)
fastapi/concurrency.py 100.00% <100.00%> (ø)
fastapi/dependencies/utils.py 100.00% <100.00%> (ø)
tests/test_tutorial/test_async_tests/test_main.py 100.00% <100.00%> (ø)
.../test_tutorial/test_websockets/test_tutorial002.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d26fa5...7c19efb. Read the comment docs.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 327cfd0 at: https://60f5d124cc234109837cf232--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 17ed7ea at: https://60f5d4a51fb0c609691189c3--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 0040972c9f53817f64e7b401c9a62b2d32cbae69 at: https://60f6b586a187b6c97290d32d--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 7af1e84 at: https://60f6b6716548bbcdf708fea8--fastapi.netlify.app

@github-actions
Copy link
Contributor

📝 Docs preview for commit 0c7195f at: https://60fbddc1d5d642d3e7109471--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2021

📝 Docs preview for commit ada7c74 at: https://61090286422fcaca80ac71ea--fastapi.netlify.app

@espetro
Copy link

espetro commented Aug 17, 2021

Hi! Thanks for such an amazing work 🙌🏼 , I cannot wait to try trio with FastAPI. How are we supposed to enable it?

@graingert
Copy link
Contributor Author

Hi! Thanks for such an amazing work 🙌🏼 , I cannot wait to try trio with FastAPI. How are we supposed to enable it?

You'll need to pip install this branch from git

@ArcLightSlavik
Copy link
Contributor

Hi! Thanks for such an amazing work 🙌🏼 , I cannot wait to try trio with FastAPI. How are we supposed to enable it?

You'll need to pip install this branch from git

Antony to the rescue 😉 https://www.youtube.com/watch?v=AQrskWh-F5E

@dhirschfeld
Copy link

You'll need to pip install this branch from git

As a conda user it would be great to have this in a release (conda-forge only package pypi releases).
@graingert has been keeping this up-to-date with master - is there anything stopping it being merged?

@adriangb
Copy link
Contributor

is there anything stopping it being merged?

I think the only thing missing is review from @tiangolo

@github-actions
Copy link
Contributor

📝 Docs preview for commit a539aa6 at: https://614e064a38c62108f4aa04d4--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

📝 Docs preview for commit 51c5edd at: https://615db50772917d315e65389c--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

📝 Docs preview for commit 9b52693 at: https://615dba62e9b158384170e013--fastapi.netlify.app

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

📝 Docs preview for commit 96cb5b2 at: https://615dbd0e3c862141e444a469--fastapi.netlify.app

later it will be required by Starlette 0.16.0
@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

📝 Docs preview for commit 7c19efb at: https://615dbeb18d64483d2c550e56--fastapi.netlify.app

@tiangolo
Copy link
Owner

tiangolo commented Oct 6, 2021

Thanks for all the work @graingert! 👏 🍰

I refactored a couple of things, to keep the same style of import/reexports in the rest of the places (without __all__). And I refactored the re-implementation of asyncio.gather() to simplify it and inline it a bit as the utility functions are not re-exported either way.

I also pinned Starlette to the minimum version that supports AnyIO (0.15.0) to make it easier for others to gradually migrate. I'll make a release with this. And then I'll upgrade Starlette and make another release.

This will be available in a couple of hours in FastAPI 0.69.0. 🎉

@tiangolo tiangolo changed the title support trio via anyio ✨ Add support for Trio via AnyIO Oct 6, 2021
@tiangolo tiangolo merged commit 11d0a08 into tiangolo:master Oct 6, 2021
@graingert graingert deleted the anyio branch October 6, 2021 15:33
@graingert
Copy link
Contributor Author

I also pinned Starlette to the minimum version that supports AnyIO (0.15.0) to make it easier for others to gradually migrate.

You should definitely pin to 0.16.0, the breaking change is around the TestClient(async_backend) kwarg which didn't exist before 0.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trio - Python library for async concurrency and I/O
7 participants