https://pantsbuild.org/ logo
m

mysterious-motherboard-97366

03/26/2022, 12:12 AM
šŸ‘‹ Hello everyone. Iā€™m interested in using Pants to install packages from a private Python package index hosted by Azure Artifacts. The recommended solution is to install a plugin for keyring so that pip can use it to discover the credentials: https://pip.pypa.io/en/stable/topics/authentication/#keyring-support. In this case, keyring, artifacts-keyring (the plugin) and pip would all be installed in the same virtualenv so pip can find the plugin. Is this possible to do with Pants?
h

happy-kitchen-89482

03/26/2022, 2:19 AM
Hi! Interesting use case. Let me think about this for a second.
Which version of Pants are you on?
Pants invokes Pip via Pex, and both Pex and the underlying Pip are strongly sandboxed, for secure and repeatable builds. So I don't see an easy way to do this without some code changes.
You can set
Copy code
[python-repos]
indexes.add = ["https://<your-feed-name>:<your-PAT-key>@pkgs.dev.azure.com/<your-organization-name>/<your-project-name>/_packaging/<your-feed-name>/pypi/simple/"]
in
pants.toml
see here for details
But obviously this is not great because it exposes your Personal Access Token
But, you can set this in your private
.pants.rc
file
So that should work as a workaround
And if you can open a feature request issue at https://github.com/pantsbuild/pants/issues/new/choose for the better solution of supporting keyring, that would be awesome
m

mysterious-motherboard-97366

03/28/2022, 4:26 PM
Thanks for the quick reply! I am using Pants 2.10. I will open a feature request.
h

happy-kitchen-89482

03/29/2022, 1:16 AM
Great! Let us know if that workaround works for you until we can figure this out
@average-balloon-31442 can you see this thread?
šŸ‘ 1
4 Views