You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Installing types-requests breaks urllib3 2.0 type hints #10786
requests 2.31.0 depends on urllib3, and supports both urllib3 1.21.x and urllib3 2.0.x. requests does not have inline type hints. urllib3 1.x did not have inline type hints, we introduced them in urllib3 2.0, as correctly identified here:
mypy --strict t.py reports no error, unless I run pip install types-requests, which installs types-requests 2.31.0.6 AND types-urllib3 1.26.25.14. At this point, the typeshed package takes precedence even if I'm using urllib3 2.0.5 at runtime, and mypy --strict t.py reports:
t.py:6: error: Call to untyped function "connect" in typed context [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)
The manual fix is to manually uninstall types-urllib3, but is there a way to make this work without manual intervention?
We'd like to change our types-requests package so that it depends on urllib3 rather than types-urllib3. Unfortunately, doing so breaks our tests due to a limitation of how our CI is set up -- our tests start complaining about differences between our outdated stubs for urllib3 and the inline types in the runtime package for urllib3, and it's all a bit of a mess.
However, good news! In four days, we're due to remove our stubs for urllib3 from typeshed (#6898). Once we do so, we can easily change types-requests so that it depends on urllib3 rather than types-urllib3, which will resolve this issue for you.
Activity
AlexWaygood commentedon Sep 27, 2023
Thanks for filing the issue!
We'd like to change our
types-requestspackage so that it depends onurllib3rather thantypes-urllib3. Unfortunately, doing so breaks our tests due to a limitation of how our CI is set up -- our tests start complaining about differences between our outdated stubs forurllib3and the inline types in the runtime package forurllib3, and it's all a bit of a mess.However, good news! In four days, we're due to remove our stubs for
urllib3from typeshed (#6898). Once we do so, we can easily changetypes-requestsso that it depends onurllib3rather thantypes-urllib3, which will resolve this issue for you.TL;DR: closing as a duplicate of #10142 ;)
AlexWaygood commentedon Oct 1, 2023
@pquentin hopefully this is resolved with
types-requests>=2.31.0.7?