salmon-barista-63163
08/13/2021, 3:23 PMindexes.add = [<index>]
The part that I do not understand is how to get pants to see the authentication token for this repo. I am using pants 1.30 (I cannot update this repo at this time to a later version)
Any guidance is appreciated herefresh-cat-90827
08/13/2021, 3:28 PM2.x
, but please see https://github.com/pantsbuild/pants/issues/12178salmon-barista-63163
08/13/2021, 3:29 PMsalmon-barista-63163
08/13/2021, 3:30 PMPANTS_PYTHON_REPOS_INDEXES="+['<https://username:password@my.hosted.server/api/pypi/my-pypi/simple>']"
fresh-cat-90827
08/13/2021, 3:30 PMcat ~/.pants/your-company-pypi.toml
[python-repos]
indexes = ["<https://username:password@mypypi.com/api/pypi/simple>", "<https://pypi.python.org/simple>"]
fresh-cat-90827
08/13/2021, 3:31 PMexport PANTS_CONFIG_FILES="$HOME/.pants/your-company-pypi.toml"
in .bashrc
or whatever shell it isfresh-cat-90827
08/13/2021, 3:32 PM~/.pants/your-company-pypi.toml
the ~/.pants
location is arbitrary! It could have been ~/bla/your-company-pypi.toml
salmon-barista-63163
08/13/2021, 3:32 PM.bashrc
to grab and set the env vars. In our CI envs we have these saved as secrets. This will work 🙂fresh-cat-90827
08/13/2021, 3:35 PMsalmon-barista-63163
08/13/2021, 3:36 PMfresh-cat-90827
08/13/2021, 3:39 PMpip.conf
file (because currently if you do pip install package
that you’d like to grab from a private PyPI), you need to either provide --extra-index-url
with credentials, or store it in the pip.conf
file (https://pip.pypa.io/en/latest/topics/configuration/). So for Pants you end up storing credentials in one place (PEX doesn’t seem to be able to read the pip.conf
file or .netrc
file (https://stackoverflow.com/questions/50468951/credentials-in-pip-conf-for-private-pypi), and in another file for pip
🙂fresh-cat-90827
08/13/2021, 3:41 PMpip.conf
and netrc
files, so there is a duplication of information; nothing critical, but thought worth sharing with you — you may have a user who does some operation outside of Pants (maybe experimenting pulling in some package in a Python virtual environment) wondering why they can’t install packages from your private PyPI despite the PyPI credentials stored somewhere to be used by Pantssalmon-barista-63163
08/13/2021, 3:56 PMhundreds-father-404
08/13/2021, 6:34 PMsalmon-barista-63163
08/13/2021, 6:38 PMsalmon-barista-63163
08/13/2021, 6:38 PM