Skip to content

✨ Add support for Trio via AnyIO#3372

Merged
tiangolo merged 24 commits intofastapi:masterfrom
graingert:anyio
Oct 6, 2021
Merged

✨ Add support for Trio via AnyIO#3372
tiangolo merged 24 commits intofastapi:masterfrom
graingert:anyio

Conversation

@graingert
Copy link
Contributor

Fixes #310

see also Kludex/starlette#1157

@graingert
Copy link
Contributor Author

graingert commented Jun 26, 2021

currently blocked on Kludex/starlette#1210

@graingert
Copy link
Contributor Author

@tiangolo can you enable my CI builds?

@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

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2021

@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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2021

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

github-actions bot commented Oct 6, 2021

@tiangolo
Copy link
Member

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 fastapi: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