bitter-ability-32190
06/29/2023, 3:17 PMpip inspect JSON output)
Do you see this as an extension of pex3 lock create or a new subcommand pex3 lock pip-report) I'm thinking in good UNIX style it should be something new and dedicated, that way it can be composed with the other commands if needed.
And for what I can tell the Pex lockfile is just a subset of information in the report, so the code should be dead simple.bitter-ability-32190
06/29/2023, 3:18 PMpip install --dry-run --report then feed that into Pex's lockfile creation so we get 0-download installs (where possible)bitter-ability-32190
06/29/2023, 4:00 PMAnd for what I can tell the Pex lockfile is just a subset of information in the report, so the code should be dead simple.Correction: The
locked_resolves information seems to be a subset, the other metadata keys are not so easily populatedbitter-ability-32190
06/29/2023, 4:09 PMpip, and split support into the two use-cases:
• pip install --dry-run --report <temppath> --quiet <args>
◦ This way Pex should have ~0 overhead over what pip would do. I'm sure there's thorns
• pip inspect --path <venv>
Really I think I'm most interested in #1, but #2 support follows, I think, once Pex can parse a reportbitter-ability-32190
06/29/2023, 4:20 PMpip download and not pip install --dry-run --report <file>enough-analyst-54434
06/29/2023, 5:26 PMbitter-ability-32190
06/29/2023, 5:32 PM+ That functionality is newer than locksI see that.
pip 23 is when it went stable. We should be able to detect that, I think.
That functionality is local to the venv (say CPython 3.9.6 exactlyIn the case of
inspect, yes. My current thinking is not supporting inspect and instead doing the --dry-run thing in Pex. That leaves the door open for inspect support later
Speeding up locking has already been experimentally vetted and issued for quite some time by seeding a venv then installing in that, etc. Have you reviewed and rejected that?Yes and no? This is one step further, and possibly one step sideways? IIUC asking
pip for a report would be semantically equivalent to making the venv, but without any time spent on actually installing. So, you get the benefits and then some?bitter-ability-32190
06/29/2023, 5:34 PMbitter-ability-32190
06/29/2023, 5:34 PMbitter-ability-32190
06/29/2023, 8:21 PMenough-analyst-54434
06/29/2023, 9:16 PMbitter-ability-32190
06/29/2023, 9:16 PMenough-analyst-54434
06/29/2023, 9:17 PMbitter-ability-32190
06/29/2023, 9:18 PMenough-analyst-54434
06/29/2023, 9:18 PMbitter-ability-32190
06/29/2023, 9:19 PMbitter-ability-32190
06/29/2023, 9:19 PMenough-analyst-54434
06/29/2023, 9:19 PMenough-analyst-54434
06/29/2023, 9:20 PMenough-analyst-54434
06/29/2023, 9:21 PMbitter-ability-32190
06/29/2023, 9:21 PMenough-analyst-54434
06/29/2023, 9:21 PMbitter-ability-32190
06/29/2023, 9:21 PMenough-analyst-54434
06/29/2023, 9:21 PMenough-analyst-54434
06/29/2023, 9:21 PMbitter-ability-32190
06/29/2023, 9:23 PMbitter-ability-32190
06/29/2023, 9:23 PMbitter-ability-32190
06/29/2023, 9:24 PMbitter-ability-32190
06/29/2023, 9:38 PMbitter-ability-32190
06/29/2023, 9:47 PMbitter-ability-32190
06/30/2023, 1:20 AMenough-analyst-54434
06/30/2023, 1:29 AMbitter-ability-32190
06/30/2023, 1:58 AMbitter-ability-32190
07/05/2023, 6:02 PMpip install --dry=run --report
josh@cephandrius:~/work/pex$ rm -rf ~/.pex/pip_cache && rm -rf ~/.pex/fingerprints.db
josh@cephandrius:~/work/pex$ time PEX_VERBOSE=1 python -m pex.cli lock create --style strict --pip-version 23.2.dev0 --resolver-version pip-2020-resolver --intransitive requests
pex: Resolving for:
pex: Hashing pex: 29.5ms
pex: Isolating pex: 0.0ms
pex: Resolving for:
pex: Found 0 fingerprints cached in database.
pex: Resolving for:
pex: Fetching PEP-691 index metadata from <https://pypi.org/simple/requests/> for application/vnd.pypi.simple.v1+json: 154.8ms
pex: Resolving for:
pex: Resolving for:8 :: Caching 1 fingerprints in database
/usr/bin/python3.8: 909.2ms
pex: Searching for 1 fingerprints in database: 8.2ms
pex: Making 1 PEP-691 JSON API requests across 1 threads to fingerprint 1 artifacts: 165.4ms
pex: Caching 1 fingerprints in database: 11.8ms
pex: Creating lock from resolve: 15.1ms
pex: Building 0 source distributions to gather metadata for lock.: 8.5ms
pex: Using cached artifact at /home/josh/.pex/downloads/58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f for FileArtifact(url='<https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl>', fingerprint=Fingerprint(algorithm='sha256', hash='58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f'), verified=False, filename='requests-2.31.0-py3-none-any.whl')
pex: Indexing downloads: 0.3ms
{"allow_builds": true, "allow_prereleases": false, "allow_wheels": true, "build_isolation": true, "constraints": [], "locked_resolves": [{"locked_requirements": [{"artifacts": [{"algorithm": "sha256", "hash": "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f", "url": "<https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl>"}], "project_name": "requests", "requires_dists": ["PySocks!=1.5.7,>=1.5.6; extra == \"socks\"", "certifi>=2017.4.17", "chardet<6,>=3.0.2; extra == \"use_chardet_on_py3\"", "charset-normalizer<4,>=2", "idna<4,>=2.5", "urllib3<3,>=1.21.1"], "requires_python": ">=3.7", "version": "2.31.0"}], "platform_tag": ["cp38", "cp38", "manylinux_2_31_x86_64"]}], "path_mappings": {}, "pex_version": "2.1.137", "pip_version": "23.2.dev0", "prefer_older_binary": false, "requirements": ["requests"], "requires_python": [], "resolver_version": "pip-2020-resolver", "style": "strict", "target_systems": [], "transitive": false, "use_pep517": null}
real 0m1.114s
user 0m0.605s
sys 0m0.116s
josh@cephandrius:~/work/pex$ rm -rf ~/.pex/pip_cache && rm -rf ~/.pex/fingerprints.db
josh@cephandrius:~/work/pex$ time PEX_VERBOSE=1 python -m pex.cli lock create --style strict --pip-version 23.2.dev0 --resolver-version pip-2020-resolver --intransitive requests
pex: Resolving for:
pex: Hashing pex: 30.3ms
pex: Isolating pex: 0.0ms
pex: Resolving for:
/usr/bin/python3.8: 756.4ms
{"allow_builds": true, "allow_prereleases": false, "allow_wheels": true, "build_isolation": true, "constraints": [], "locked_resolves": [{"locked_requirements": [{"artifacts": [{"algorithm": "sha256", "hash": "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f", "url": "<https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl>"}], "project_name": "requests", "requires_dists": ["PySocks!=1.5.7,>=1.5.6; extra == \"socks\"", "certifi>=2017.4.17", "chardet<6,>=3.0.2; extra == \"use_chardet_on_py3\"", "charset-normalizer<4,>=2", "idna<4,>=2.5", "urllib3<3,>=1.21.1"], "requires_python": null, "version": "2.31.0"}], "platform_tag": ["cp38", "cp38", "manylinux_2_31_x86_64"]}], "path_mappings": {}, "pex_version": "2.1.137", "pip_version": "23.2.dev0", "prefer_older_binary": false, "requirements": ["requests"], "requires_python": [], "resolver_version": "pip-2020-resolver", "style": "strict", "target_systems": [], "transitive": false, "use_pep517": null}
real 0m0.956s
user 0m0.584s
sys 0m0.114sbitter-ability-32190
07/05/2023, 6:03 PMpip of the latest version now supports the PEP 658 metadata, and PyPI currently is serving it for packages uploaded as of ~some date.
So for requests `2.131.0`: https://files.pythonhosted.org/packages/70/8e/0e2d847013cb52cd35b38c009bb167a1a26b2ce6cd6965bf26b47bc0bf44/requests-2.31.0-py3-none-any.whl.metadatabitter-ability-32190
07/05/2023, 6:04 PMpip is seeing that the index supports PEP 658, and instead of downloading requests for the metadata, just downloads the metadata directly.
They plan on backfilling at some point, but haven't yet, so it's a microbenchmark with one packageenough-analyst-54434
07/05/2023, 6:13 PM--style universal lock, which might visit 10k nodes that all have the new metadata, Pex will only actually download the final solution set. So you save on that final download, but only that. You also need to backfill all the missing hashes using the dry run (universal needs to include artifacts beyond those for the current venv) and then there is the technical point to confirm whether the runtime patching used to get the universal resolve resukt correct in the 1st place works with inspect. It may need to be adapted.enough-analyst-54434
07/05/2023, 6:14 PMenough-analyst-54434
07/05/2023, 6:15 PMenough-analyst-54434
07/05/2023, 6:15 PMenough-analyst-54434
07/05/2023, 6:18 PMbitter-ability-32190
07/05/2023, 6:18 PMenough-analyst-54434
07/05/2023, 6:19 PMbitter-ability-32190
07/05/2023, 6:19 PMbitter-ability-32190
07/05/2023, 6:20 PMbitter-ability-32190
07/05/2023, 6:20 PMjq myself into a Pex lockfile and reap the benefits for myselfenough-analyst-54434
07/05/2023, 6:26 PMenough-analyst-54434
07/05/2023, 6:27 PMbitter-ability-32190
07/05/2023, 6:37 PM