pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.53k stars 259 forks source link

Drop support for urllib #58

Closed wickman closed 2 months ago

wickman commented 9 years ago

This would mean either making requests an explicit dependency, or vendoring it. There's a bunch of stuff that requests gives us that is just plain smart (verify=True, more sensible retry policies, etc.) Right now we abstract away the smarts which makes it hard to implement features like #26.

jsirois commented 2 months ago

The switch from a bespoke resolver to using vendored Pip under the hood solved this issue for the most part. The vendored Pip and any bootstrapped Pip's do use their own vendored requests and Pex is left using its URLFetcher wrapper over urllib for these activities:

Of these, only the PEP-691 case is hit regularly for lock users. The discovered metadata is cached with no TTL; but any lock update using PyPI, which supports PEP-691 is going to exercise URLFetcher urllib code. That code does support timeouts as well as the equivalent of requests verify={True,/path/to/cert-bundle} and has now been battle tested for several years to be at least decent enough to not net bug reports. Since Pex has gone the route of being dependency free, that leaves vendoring a version of requests still compatible with Python 2.7; i.e. requests==2.27.1. That nets a ~600KB size-increase to the ~3.5MB Pex wheel. Although not unreasonable, there's just no current impetus to take on this dependency with the improvements to urllib use that have transpired.