Does `pex3 lock create` respect `~/.config/pip/pip...
# pex
b
Does
pex3 lock create
respect
~/.config/pip/pip.conf
? I assume it does by nature of leveraging
pip
, but
pex3 lock create --no-pypi --no-build -r repository.txt -o repository.lock
is giving me:
Copy code
ERROR: Could not find a version that satisfies the requirement timeout-decorator==0.5.0 (from -r repository.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for timeout-decorator==0.5.0 (from -r repository.txt (line 1))
Equivalently running
pip install timeout-decorator==0.5.0
in the same terminal works, and downloads the wheel from our CodeArtifact
e
It seems like you answered your question by experiment, but Pex purposely ignores pip.conf: https://github.com/pantsbuild/pex/blob/c2fa8130d3dfb38f19f550a5bb0a3c69b7459f0d/pex/pip/tool.py#L291-L294
b
I guess the other half to this is how would I wire up the config to work? I didn't see an option using
--help
.
e
There is no option for that.
b
For context I'm trying to use a private repo provided through AWS CodeArtifact. The instructions for configuration only have it configured through the config
e
Pants users have definitely used CodeArtifact. Not sure what they did.
Those instructions look pretty clear to me.
"Configure pip without the login command" with --index
b
Yeah looks like env vars support may work:https://github.com/pantsbuild/pex/issues/1803
Although unfortunately that's going to be painful to roll out to every dev. I'm guessing Pex also ignores the config when downloading and installing wheels, so this will bite me on the other side of the lockfile too
e
It does it in all contexts.
b
Thats seems what I'd expect 🙂
Looks like:
Copy code
CODEARTIFACT_AUTH_TOKEN=$(python3.8 -c 'parser=__import__("configparser").ConfigParser();parser.read("/root/.pypirc");print(parser["codeartifact"]["password"])')
along with
Copy code
--no-pypi \
    --index <https://aws>:$CODEARTIFACT_AUTH_TOKEN@<instance>.<http://d.codeartifact.us-east-1.amazonaws.com/pypi/pypi-store/simple|d.codeartifact.us-east-1.amazonaws.com/pypi/pypi-store/simple> \
might do the trick I'll work from there
So everything seems to work alright in Pex land. Pants however blocks the env var expansion happening correctly 🤦‍♂️