-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Extract URLFetcher for reuse with lock files. #1406
Conversation
Lock file generation will need to download and hash dists when their hashes are not presented in PEP 503 link fragments and we'll also need to download dists directly if we optimize the resolving from a lock file case when the lock file contains urls ala PEP-665. Work towards pex-tool#1401.
proxies = {protocol: network_configuration.proxy for protocol in ("http", "https")} | ||
|
||
handlers = [ProxyHandler(proxies), HTTPSHandler(context=ssl_context)] | ||
if handle_file_urls: |
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.
The only changes to this class besides being moved from requirements.py to here are:
- Drop "ftp" from the proxy protocols above since we don't install the FtpHandler / never intended to support plaintext FTP.
- Add optional FileHandler support which will be needed / useful for handling --find-links "downloads" from local find-links repos in a way that keeps manual dist hashing code uniform / simpler.
@@ -108,13 +108,15 @@ def exec_function(ast, globals_map): | |||
|
|||
from urllib.error import HTTPError as HTTPError | |||
from urllib.request import build_opener as build_opener | |||
from urllib.request import FileHandler as FileHandler |
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.
N.B.: On general Pex requirements for the uninitiated:
- It still supports Python 2.7
- It ships as both a distribution on PyPI and a Pex PEX via github releases.
2 makes it extremely unattractive to vendor requests since its (indirectly) platform-specific and the shipped Pex PEX - which is currently pure python - would need to grow multiplatform support that included {linux wheels, and two flavors of macOS wheels} X {2.7, 3.5...3.9}.
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.
Thanks for splitting this out into prework :)
Lock file generation will need to download and hash dists when their
hashes are not presented in PEP 503 link fragments and we'll also need
to download dists directly if we optimize the resolving from a lock file
case when the lock file contains urls ala PEP-665.
Work towards #1401.