-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
Use optional package installs. #219
Comments
I like this, since this would solve an issue I have with a Docker container on which the installation of uvloop fails (not enough RAM). However, does this mean that just doing |
What about:
In this case a plain install should give a fully working server, all in pure Python. The user can then separately install uvloop/httptools/websockets, or use the |
I'd be happy with that yup. Tho I'd probably prefer |
Implementation in #224 resolves this as requested in the opening of this...
We could easily make sure that Uvicorn raises loud errors if the cli is used and click isn't installed. Or we could go with @almarklein's suggestion and make the base case be the pure install. |
cc @carlwgeorge |
Should I go ahead and rework the PR to match the layout in #219 (comment)? Also, should |
@carltongibson @almarklein Depends which of the two we think makes more sense. (And yes, we'd include The alternative tack would be to keep everything as per #219, except using this:
|
(Did you mean me?) |
@carltongibson Nope. I meant @carlwgeorge (hits autocomplete a few more times) |
I agree that |
resolves encode#219
resolves encode#219
A lightweight option here would be... pip install uvicorn # Just click, h11.
pip install uvicorn[full] # +websockets +watchdog +uvloop/httptools (conditional on env markers) |
That’s probably a good balance of:
Right? |
resolves encode#219
@tomchristie Jupp, that would really be helpful. I currently have to use h11 because httptools ships no wheels and I'd need manylinux wheels to be able to use it. What's needed to move this forward? |
This just made me realize that https://www.uvicorn.org/settings/#implementation seems to be wrong nowadays. |
@apollo13 - I'm not sure what you mean? $ python -m venv venv
$ venv/bin/pip install httptools
Collecting httptools
Installing collected packages: httptools
Successfully installed httptools-0.0.13 |
@tomchristie Looking at PyPI it is just a tar.gz https://pypi.org/project/httptools/#files and the setup.py says: https://github.com/MagicStack/httptools/blob/master/setup.py#L27-L32 so I'd argue it needs a compiler. Your system seems to have one so it just work (tm) |
In a docker container:
|
So is |
My initial interest for this issue was also because in a docker container it would compile the dependencies from source. The problem for me (at the time) was that the build of uvloop requires more RAM than I had available on my cheap VM. All that aside, for services that have low traffic, I prefer the pure Python libs, because it makes the docker container much lighter, so I can host more services on a VM without needing to upgrade my hardware. BTW: #298 is ready to go from my end :) |
@almarklein - Great yup! It's number one on my list. Just waiting for a proper moment so I can review if there's anything else we'd want in a "Uvicorn 0.11" release. |
Yes, and it would fail for you to if you wouldn't have a compiler installed (pip nicely hides that fact). |
Not necessarily, because binary wheels, right? I'd think the binary wheels are compatible with most Linux Docker images, but somehow Pip does not think so. (Not my area of expertise tho, maybe someone else knows better.) |
@almarklein httptools does not ship wheels though: https://pypi.org/project/httptools/#files
depends, most of them are just not compatible with alpine linux afaiks. |
Oh: "Alpine uses a different C library, musl, instead of the more common glibc." (source) |
I'm slightly surprised we're not seeing more folks chiming in with "installing uvicorn fails on my platform". Do either of "websockets" (Includes a small C extention but I think has an optional pure python fallback) or "uvloop" also fail to install for you. I'm wondering if there's an environment marker or some other workaround we could use to make sure that they only installed optionally. (Tho we're probably okay once we move to |
Because most people can compile stuff; I also can but I try to avoid it because it should run everywhere.
If you look at websockets (https://pypi.org/project/websockets/#files) they include binary wheels, no compilation needed during install, same for https://pypi.org/project/uvloop/#files
Sadly no, there is nothing that says "I can compile something" |
Just to clarify: Binary packages are fine as long as PyPI has |
Yes, this is one of the reasons why I generally try to use debian-based python docker containers because installing in them is way faster (as you can use the prebuilt wheels). As a result you can also use |
@tomchristie is there anything I can do to help move this forward? |
Uvicorn lumps several optional dependencies into a "standard" extra: - `colorama` (for Windows) - `httptools` - `python-dotenv` - `pyyaml` - `uvloop` - `watchgod`/`watchfiles` (`watchgod` was renamed to `watchfiles`) - `websockets` There has been some discussion about the drawbacks of this approach: - encode/uvicorn#219 - encode/uvicorn#1274 - encode/uvicorn#1547 inboard has previously installed the "standard" extra by default. This commit will change the default to installing Uvicorn without "standard." This is a **BREAKING CHANGE** to inboard's dependencies. A new `inboard[uvicorn-fast]` extra will be added for dependencies from `uvicorn[standard]` related to web server performance, and can be installed by specifying the extra when installing inboard, like `python -m pip install 'inboard[fastapi,uvicorn-fast]'`: - `httptools` - `uvloop` - `websockets` For users who still need all the `uvicorn[standard]` extras, a new `inboard[uvicorn-standard]` extra will be added to the inboard package, and can be installed by specifying the extra when installing inboard, like `python -m pip install 'inboard[fastapi,uvicorn-standard]'`.
Instead of the platform detection I’d like uvicorn to use optional installs.
pip install uvicorn
- Just the package itself.pip install uvicorn[standard]
- uvloop/httptools/websocketspip install uvicorn[pure]
- asyncio/h11/wsprotopip install uvicorn[full]
- EverythingThe text was updated successfully, but these errors were encountered: