https://pantsbuild.org/ logo
#general
Title
# general
g

gray-ocean-61294

04/26/2022, 6:46 PM
Hi team. I am looking at this documentation https://www.pantsbuild.org/docs/python-third-party-dependencies#custom-repositories I have a custom pypi repo that need authentication. how can I config the user name and password for this custom repo?
h

high-yak-85899

04/29/2022, 4:21 PM
Would like to bump this. I'm going to have a similar issue in the future.
g

gray-ocean-61294

05/02/2022, 3:58 PM
anyone can help on this?
h

happy-kitchen-89482

05/02/2022, 4:48 PM
This isn't available in 2.11, but in Pants 2.12 (an alpha release of which is available now at version 2.12.0a0) you can interpolate environment variables in your config files. So you can, for example, use
http://%(env.USERNAME)s:%(env.PASSWORD)s@my.custom.repo/index
or whatever and set USERNAME/PASSWORD in the Pants process's environment before running it
👍 1
In 2.11 or earlier, you can use Pants's existing support for setting config via env vars:
PANTS_PYTHON_REPOS_INDEXES='+["http://$USERNAME:$PASSWORD@my.custom.repo/index"]'
h

hundreds-father-404

05/02/2022, 4:49 PM
or set up a
,pants.rc
file where you hardcode the files: https://www.pantsbuild.org/docs/options#pantsrc-file
h

happy-kitchen-89482

05/02/2022, 4:50 PM
I will add this to the docs at that URL
🙌 1
g

gray-ocean-61294

05/02/2022, 4:54 PM
@happy-kitchen-89482 if I understand correctly, for 2.11 or early, I cannot do it in pants.toml file. in 2.12, we can start using in toml file? in 2.11 or early, I can use this pattern
Copy code
PANTS_PYTHON_REPOS_INDEXES="...." ./pants
h

hundreds-father-404

05/02/2022, 4:55 PM
correct, specifically the
env
interpolation is new to 2.12
👍 1
h

happy-kitchen-89482

05/02/2022, 5:09 PM
4 Views