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

ASGI 3 #435

Merged
merged 6 commits into from
Mar 19, 2019
Merged

ASGI 3 #435

merged 6 commits into from
Mar 19, 2019

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented Mar 12, 2019

Refs django/asgiref#78 and django/asgiref#80

In short:

  • ASGI 2 defines the interface as: `a callable taking 'scope' that returns an async callable taking 'receive' and 'send' arguments'
  • ASGI 3 defines the interface as `an async callable taking 'scope', 'receive' and 'send' arguments'.

So previously...

def hello_world(scope):
    async def inner(receive, send):
        ...
    return inner

Would become more simply, this:

async def hello_world(scope, receive, send):
    ...

It's a big change to have to make throughout the stack, and about as late in the day as we'd still be able to get away with it, but it'll be worth it for the simpler interface, clearer tracebacks, and easier-to-write applications and middleware classes.

See also encode/uvicorn#325

@tomchristie
Copy link
Member Author

Would need a version bump to 0.12.0.

@tomchristie
Copy link
Member Author

tomchristie commented Mar 12, 2019

@florimondmanca @tiangolo Particularly relevant to you folks.

(Are FastAPI and Bocadillo pinned against the current 0.11.x release cycle?)

I'll prob. coordinate with responder folks to make the upgrade there, once this is in.

@florimondmanca
Copy link
Member

florimondmanca commented Mar 12, 2019

Big change indeed! But agreed that the simpler interface is worth it. Bocadillo is safe as it has Starlette pinned to starlette>=0.11, <0.12. Thanks for the heads up!

Copy link

@mbeacom mbeacom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@jordaneremieff jordaneremieff mentioned this pull request Mar 17, 2019
@tiangolo
Copy link
Member

Sorry for the delay and thanks for the ping.

Yep, FastAPI is pinned too to 11.x. ✔️

@tomchristie
Copy link
Member Author

Okay, we'd best just push on with this.

Might roll a -beta prerelease. We probably don't want a general release until either or both of hypercorn, daphne have support for ASGI 3.

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.

4 participants