gifted-refrigerator-82216
04/07/2025, 9:45 AMpackage @ <https://secret-name>:@pypi.url.com/packages/package.whl#sha256=<hash> (the credentials have an empty password). We don't specify <http://pypi.url.com|pypi.url.com> in python-repos.indexes of pants.toml because that would pull in other dependencies from that index, which we don't want. We have other indexes specified there for other packages.
Up to (and including) pants 2.20 (pex 2.1.163), generating a lockfile worked as advertised, and the secret package URL makes it into the lockfile.
Starting with pants 2.21 (pex 2.3.1), lockfile generation fails with this error during pex download:
pid [...] -> [...]/bin/python [...]/pex --disable-pip-version-check --exists-action a --no-input --no-python-version-warning --isolated --log [...]/.tmp/pex-pip-log.cvdej1rr/pip.log -q --cache-dir [...]/pip_cache download --dest [...]/fingerprint_artifact.ri_3r9h6 --no-deps package @ <https://pypi.url.com/packages/package.whl> --index-url [...] --retries 5 --timeout 15 exited with 1 and STDERR:
pip: ERROR: HTTP error 401 while getting <https://pypi.url.com/packages/package.whl>
pip: ERROR: Could not install requirement package==[...] from <https://pypi.url.com/packages/package.whl> because of HTTP error 401 Client Error: Unauthorized for url: <https://pypi.url.com/packages/package.whl> for URL <https://pypi.url.com/packages/package.whl>
The crucial observation here is that the credentials are missing from the URL. I manually ran the command again with credentials in the package URL and it worked as expected.
When inspecting sandbox created during lockfile generation, I enabled preservation of pip.log and observed that the pex lock create command succeeds.
Afterwards, the lockfile generation seems to run this pex download command (without package URL credentials), which then fails.
This observation leads me to suspect that pants may be involved here (rather than pex), which is why I'm posting here for advice.
Thank you in advance!gorgeous-winter-99296
04/07/2025, 10:13 AMgifted-refrigerator-82216
04/07/2025, 11:07 AMgorgeous-winter-99296
04/07/2025, 11:12 AMfast-nail-55400
04/07/2025, 1:53 PMfast-nail-55400
04/07/2025, 1:54 PM—keyring-provider option now so you can auth with private indices.fast-nail-55400
04/07/2025, 1:55 PMhappy-kitchen-89482
04/07/2025, 11:54 PMhappy-kitchen-89482
04/07/2025, 11:54 PM.netrchappy-kitchen-89482
04/07/2025, 11:56 PMhappy-kitchen-89482
04/07/2025, 11:57 PMgifted-refrigerator-82216
04/08/2025, 9:57 AM~/.netrc, requiring our developers to update that file each time our credentials expire.
I think I'll set up (yet another) internal package index and use that one for the private packages, which are causing the issue. It's a bit more infra but the tooling configuration remains at existing level of complexity.
Thanks again!happy-kitchen-89482
04/08/2025, 6:36 PM