-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
Make async dependencies optional. #2858
base: master
Are you sure you want to change the base?
Conversation
Tests currently blocked on |
Resolved |
http2 = [ | ||
"h2>=3,<5", | ||
"httpcore[http2]", | ||
] | ||
socks = [ | ||
"socksio==1.*", | ||
"httpcore[socks]", | ||
] | ||
asyncio = [ | ||
"httpcore[asyncio]" | ||
] | ||
trio = [ | ||
"httpcore[trio]" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting... currently we're including the httpcore
dependencies explicitly.
Eg. pip install httpx[socks]
uses the dependency socksio==1.*
instead of the dependency httpcore[socks]
.
The second style makes more sense, because that's what we're actually trying to effect... but I'm a bit hesitant that some Python install tooling might incorrectly fail to install httpcore[socks]
as an optional dependency when the httpcore
dependancy is already included. Is my hesitancy well founded here, or are we okay to use this new style throughout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should always work but you're right that it's tool dependent and the Python specification around this does not provide guarantees.
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
remove anyio. |
If async is optional, should we improve the unit test so that it can skip some tests when certain optional dependencies are not installed? And can we consider conducting separate tests in CI for both scenarios: when optional dependencies are not installed and when they are already installed? |
@abersheeran I don't know. We don't have any need for that in CI, but perhaps some folks would appreciate fast runs in local dev. Perhaps spin it out into a new discussion? |
It's probably worthwhile to make sure the project works as intended in some basic form during CI without the optional dependencies. |
I'm not sure it's fair to say we should have a separate discussion when we need something like it for reasonable coverage of the changes introduced in this pull request. I think "skip tests when the dependencies are not available for better developer experience" makes sense as a new discussion, but "ensure the library works without the async dependencies installed" is critical here. Otherwise, we're just relying on manual testing to ensure the default installation of the library isn't broken. If you have a strong preference for a follow-up pull request, I can get behind that, but I think we need automated testing before release. |
@zanieb Ah interesting. I've perhaps been missing your intent here. I had "should we ensure the tests can run without all dependencies installed?". |
👍
Yeah I think this is the idea. We should run some subset of the tests (i.e. the synchronous API) in CI with the default install dependencies to ensure things are working as intended now (and in the future). |
@zanieb Do we want to block this on "run the tests without all dependencies installed" or not? There's a chunk of work there that I'd suggest would need to be taken on incrementally if we want to deal with it. |
I'm okay with merging this and addressing as a follow-up! |
Co-authored-by: Zanie Blue <contact@zanie.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to push into #3319 ?
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
See the "Version 1.0, Minimising project dependancies" discussion for background, as well as the proposed PR for
httpcore
version 1.0.This pull request would changes our default install footprint from...
httpcore
certifi
h11
sniffio
anyio
idna
To this...
httpcore
certifi
h11
idna
We do also have scope to make
idna
support optional, but this pull request doesn't address that.