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

(dev server) support for Subscriptions requires uvicorn[standard] #586

Closed
ossareh opened this issue Nov 18, 2020 · 8 comments · Fixed by #588
Closed

(dev server) support for Subscriptions requires uvicorn[standard] #586

ossareh opened this issue Nov 18, 2020 · 8 comments · Fixed by #588
Labels
enhancement New feature or request
Milestone

Comments

@ossareh
Copy link
Contributor

ossareh commented Nov 18, 2020

To use Subscription websockets are required, to enable websockets you need to install uvicorn[standard]. Currently pyproject.toml / poetry is only installing uvicorn. Not having the "standard" extra results in a failure to upgrade the HTTP request to WebSocket, you can see this by increasing the uvicorn log_level in cli/commands/server.py and attempting a Subscription.

I see two paths to improving this situation, I'm happy to submit a PR for either route - but I need advice on how to proceed 👍

Option 1: update dependencies in pyproject.toml

Changing the uvicorn dependency to be {version = ">=0.11.6,<0.13.0", extras = ["standard"]} would result in websockets being supported. However as per Uvicorn's QuickStart that brings in Cython dependencies which may not be what folks want.

Option 2: improve documentation to mention this requirement

The safe route, at the risk of a bit more work for the user. It's likely that any "real" deployment would have folks needing to be a bit more opinionated about the way they run their ASGI sever.

@BryceBeagle
Copy link
Member

Can we create an extras group that includes uvicorn[standard]? Does poetry support this?

[tool.poetry.dependencies]
uvicorn = ">=0.11.6,<0.13.0"
uvicorn_standard = { version = ">=0.11.6,<0.13.0", extras = ["standard"], optional = true }

[tool.poetry.extras]
subscriptions = ["uvicorn_standard"]

I agree that better documentation is needed regardless.

@ossareh
Copy link
Contributor Author

ossareh commented Nov 19, 2020 via email

@BryceBeagle
Copy link
Member

BryceBeagle commented Nov 19, 2020

Wait just realized a flaw here. uvicorn_standard isn't a real package, so this line won't work

uvicorn_standard = { version = ">=0.11.6,<0.13.0", extras = ["standard"], optional = true }

Not sure if poetry supports aliases

@BryceBeagle
Copy link
Member

@BryceBeagle BryceBeagle added the enhancement New feature or request label Nov 19, 2020
@patrick91
Copy link
Member

What about making the whole debug server optional as well? So if you want to use the debug server you'd need to run:

pip install strawberry[debug-server]

or something similar? Then we can provide all the dependencies we need :) I'm a bit worried that this might not be really user friendly though

@jkimbo
Copy link
Member

jkimbo commented Nov 19, 2020

+1 on making the debug server optional. I use Strawberry with Django in my project and don't need the extra things that Strawberry requires to host the debug server.

@patrick91 patrick91 added this to the Version 1 milestone Nov 19, 2020
@lijok
Copy link
Member

lijok commented Nov 19, 2020

+1 on making the debug server optional as well. We host a strawberry with django server in AWS lambda, and the smaller the packaged up system is, the faster it loads

@ossareh
Copy link
Contributor Author

ossareh commented Nov 19, 2020 via email

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

Successfully merging a pull request may close this issue.

5 participants