Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to feed in Azure Artifacts using poetry (or pipenv) with artifacts-keyring

Tags:

python

azure

I'm a bit of a beginner to working with Azure, in particular my problem is related to publishing python packages. I have a package managed with poetry, i am posting it to the private repository with the help of twine. The commands I am using to post are as follows (in this part i have installed artifacts-keyring in the virtual environment)

poetry build
python -m twine upload -r ${ARTIFACT_FEED} --config-file /PYPIRC dist/*

Here, ARTIFACT_FEED is the name of the feed. I have no problems with those commands and the package is published without problems.

Now, to use a project managed also with poetry and that uses my other package already published, I would like to do

poetry add my_package_name

With the pyproject.toml as poetry's documentation

[[tool.poetry.source]]
name = "foo"
url = <MY_PRIVATE_COMPANY_REPO_URL>
secondary = true

With artifacts-keyring installed in the virtual env, i get this error 401 Client Error: Unauthorized for url: <MY_PRIVATE_COMPANY_REPO_URL>. Using pipenv i have the same problem. Ok, maybe poetry dosen't support this kind of auth. Related links:

  1. https://github.com/microsoft/artifacts-keyring/issues/37
  2. https://github.com/microsoft/artifacts-keyring/issues/8
  3. https://github.com/python-poetry/poetry/issues/2857

Is it possible for the administrator to change the authentication type? When i enter to Connect to feed page, I see this

enter image description here

So, seems to be mandatory use artifacts-keyrings. In a previous project, for another company, we used basic authentication, like this

poetry publish --repository <PRIVATE_REPO> --username <USERNAME> --password <PASSWORD> --build

And then to install the package I had no problem.

like image 409
Andrex Avatar asked Oct 16 '25 20:10

Andrex


1 Answers

Since it took me hours to figure this out: It seems like the issue is you need to install 'artifacts-keyring' for poetry at a global level:

poetry self add artifacts-keyring

Once I did this, I could:

poetry add --source my-feed my-package
like image 130
Sellerman Avatar answered Oct 19 '25 11:10

Sellerman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!