question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Via https://gitter.im/python-trio/general?at=5e2fe9b940da694c5edc8d70

It’d be nice to have Starlette support both Trio and Asyncio.

Currently it’s an asyncio-only framework, but there’s actually not many places where we’re tied to asyncio, with the exception of a bunch of “if this callable is a plain function then call into with with run_in_threadpool, otherwise await it.”.

I think the other places are:

  • The WSGI middleware (optional). Currently has an asyncio-based implementation.
  • The BaseHTTPMiddleware class (optional), that provides a request/response middleware interface to develop against, rather than directly writing against ASGI. Again, currently has an asyncio-based implemention.
  • One weird part of the request model, .is_disconnected - that I think is structured as an anti-pattern and probably needs rethinking.
  • The graphene-based GraphQL async executor, which probably ought to come out of the core package anyways.
  • The existing TestClient, which we oughta replace with httpx now anyways, which does have trio+asyncio.

Short: Tweaking our run_in_threadpool function to use sniffio and then either call trio’s threadpooling or asyncio’s threadpooling would be sufficient as a starting point to start using Starlette with Trio.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:40
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

14reactions
gdhameejacommented, Feb 4, 2020

I’m taking this up.

7reactions
pquentincommented, Jun 24, 2020

For what it’s worth, here’s an example of Uvicorn + Starlette + FastAPI running with trio-asyncio: https://github.com/python-trio/trio-asyncio/issues/84

Read more comments on GitHub >

github_iconTop Results From Across the Web

Federal TRIO Programs - Home Page - Department of Education
The Federal TRIO Programs are educational opportunity outreach programs designed to motivate and support students from disadvantaged ...
Read more >
TRIO - Benefits.gov
You need to enable JavaScript to run this app.
Read more >
TRIO Student Support Services - CNM
TRIO Student Support Services provides assistance to qualifying students who plan to graduate from CNM and then transfer to a four-year institution.
Read more >
TRIO Support Services Program
TRIO Support Services Program · Academic Advising · One-to-One Peer Tutoring · Help Exploring Major and Minor Options · Career Exploration · Support...
Read more >
TRIO Student Support Services - University of Louisville
TRIO Student Support Services (SSS) is funded by the U.S. Department of Education and the University of Louisville. SSS is committed to helping...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found