-
-
Notifications
You must be signed in to change notification settings - Fork 792
Use optional package installs #298
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
Conversation
I'm looking into this. |
I'm not too sure how we want this to look. Eg. A alternative that we could go for would be:
(And perhaps also |
I agree that we should think this through. Especially as Uvicorn gets adopted by more frameworks. Most users won't interact with Uvicorn directly, but read the installation instructions on e.g. Responder, so the simpler we can make it, the better, I think. The "story" that I'd prefer: Do In any way, I think that most users that run |
Also reasonable:
|
Why exclude As a Windows user, I feel a bit uncomfortable with the name "standard" for something that I cannot install :) (but I can get over it) |
Anyway, it's your call :) |
Suppose we have an upstream library that wants to include the version of uvicorn most suited to the environment - are they able to do so using environment markers in the requirements? What would the requirements look like for "Install uvicorn[pure] for windows and pypy, otherwise install uvicorn[full]"? |
Right, that means we'd need to select the fast libs as supported by the platform. So back to the triage in After giving this some thought I'm not feeling too good about it, because I fear it might be fragile. E.g. we might miss something (e.g. what about IronPython), and I'm starting to feel for something like this:
|
So I'm trying to make a big push towards minimal dependency installs, so I'm quite keen on:
Running uvicorn without an http implementation loudly errors with "Install either There's other configurations that uvicorn will start to become useful in too, eg. websockets-only, or lifespan-only (multi-workers running background tasks), and I'd like to see uvicorn be equally suitable for low-memory low-footprint deployments all the way up to all-the-bells-and-whistles. |
Thanks for the clarification. I see your point. The only remaining question I have now: on Windows, will |
Yup We'd be recommending |
@tomchristie updated. Is this more or less how you'd like the installation instructions? |
For the Fedora package I'm working on, I can set up the dependencies as @tomchristie described.
All those would be installed by default, but a user can optionally disable installing the |
Rebased (for changing wsproto req to 0.13). |
Happy with this - We'll just wait for a good point to make a major version bump is all. |
Coming back to this... I think we've got three different options here, for more minimal install options. What do we think to each of these?... Option 1: $ pip install uvicorn # click, h11, websockets
$ pip install uvicorn[fast] # +httptools, +uvloop
$ pip install uvicorn[auto] # +httptools, +uvloop (cpython, linux/mac) Option 2: We could omit $ pip install uvicorn # click, h11
$ pip install uvicorn[pure] # +websockets
$ pip install uvicorn[fast] # +websockets +httptools, +uvloop
$ pip install uvicorn[auto] # +websockets (always) +httptools, +uvloop (cpython, linux/mac) Option 3: Super strict. Clear error messaging if you $ pip install uvicorn # click
$ pip install uvicorn[pure] # +websockets +h11
$ pip install uvicorn[fast] # +websockets +httptools, +uvloop
$ pip install uvicorn[auto] # +websockets (always) +h11 (pypy, windows) +httptools, +uvloop (cpython on linux/mac) I think I quite like option 3 here, since it's really easy for us to point our users at |
@tomchristie there's also the additional loop implementation currently available only for Windows - |
Yes, that's a very good point. Is it supposed to have better performance characteristics? |
I'm not sure precisely, but I think |
Oh, looks like it's the default in windows from 3.8 onwards https://twitter.com/VictorStinner/status/1109943702452088833 (So yeah, I'm perfectly okay with us essentially making it the default in 3.6, 3.7 too) |
yes, |
@gvbgduh - Actually I was being slow here. Yes, ProactorEventLoop gets used by the "auto" loop choice, which is the default, but it's not relevant to this discussion since it doesn't require a package install. |
yes, indeed! |
I'm not sure if I agree. Most users will actually use a higher level framework, and having BTW, is |
Noted. We could expect dependents to use It's not unreasonable for the base install to include h11, yeah.
I'm not sure what the deal is with platform support for websockets - from searching the issue list I get the impression that it supports pypy just fine? |
Hehe, it's that question mark at the end, right? Support for |
Yeah - probably right. So having some time to think about this I reckon we can just go really simple... $ pip install uvicorn # A minimal install - just click and h11.
$ pip install uvicorn[default] # An install complete with extras and platform dependencies - uvloop (cpython only), httptools (cpython only), websockets. Our base install actually would be perfectly sufficient for most folks, and gives us a minimal install option for anyone wanting it, but The following are also likely to be in our defaults list at some point:
I think either Does that seem like a reasonable approach? |
Yes! |
@tomchristie PR updated. I'm feeling slightly uncomfortable about the word "default", which is the tag for extra installs, so not quite the default ;) Maybe |
I don't think Perhaps this?... pip install uvicorn[standard] Any other naming ideas? |
Maybe |
Potentially, although eg. we don't want to include standard installs vs. minimal installs seems probably okay to me? I guess we could have an "everything, including wsproto" option, giving us |
Yeah, that seems to overly complicate things. Updated to |
this could be a good time to resurrect that PR since:
From the latest comments I gather here, there would be:
that leaves wsproto aside as @tomchristie last comment suggests. if that's ok I can work on it or let you @almarklein rebase and finish ! :) |
@euri10 I'm not able to work on this until next week, so please go ahead :) |
Let's close this in favour of #666. Thanks for your time on this @almarklein! |
This is #224 rebased to master. Closes #219.
I also pinned
wsproto
because uvicorn does not work for wsproto 0.13. Would probably be good to fix that (in another PR).Suggestion: what about also adding
[dev]
. We could use that in the CI script, so we'd have all dependencies defined in a single place.