3
votes

The background

I've seen this answer, How to Publish to PyPI with Azure-Pipelines and Poetry however, where the credentials are supposedly generated, I don't see that same option when I go to Connect to Feed > Python. All I see is pip and twine, both of which show how to do unauthenticated pushes.

I have an Azure DevOps Artifacts Python Feed setup where I am the administrator to it. I wanted to use poetry to publish or push the package I am working on into that Feed. However, when prompted for my credentials, I use my email, and password I use to login, but I don't think these are correct. I get a 401 Unauthorized. So here is the steps that I am doing

I created the project

poetry new phil_hello_world --src

I then added some boiler plate code in src/phil_hello_world/__init__.py

__version__ = '0.1.0'


def hello_world():
"""Hello World Function
"""
print('Hello, World!')

Then I was able to build and install the package and use it in IDLE and some other scripts.

poetry build

The problem

So, where this comes to the problem is getting my Azure DevOps Python Artifact Feed setup properly. They recommend using pip or twine, but I'm trying to use this, so bear with me.

First, I setup the repostiory so Poetry knows about it. We're going to do a local configuration.

poetry config repostiories.azure-python-feed https://pkgs.dev.azure.com/myOrg/Project/_packaging/azure-python-feed/pypi/upload

Then I tried just pushing the package up using:

poetry publish -r azure-python-feed --build

I then got a 401 Unauthorized error.

So, I tried to use my login information by doing:

poetry config http-basic.azure-python-feed ${USER_EMAIL} ${USER_LOGIN_PASS}

buuuuut, I still get 401 Unauthorized. Am I doing something wrong? I did make sure to add the recommended packages listed in the Connect Me pop-out.

poetry add twine keyring artifacts-keyring
poetry install
1
Does this answer your question? How to Publish to PyPI with Azure-Pipelines and PoetryArne
@Arne, not quite. I saw that first, but the step where they get the credentials doesn't exist or I don't see it in my Azure DevOps Artifacts section when I click on Connect to Feed. I only see pip or twine and then it shows to how setup an unauthenticated push.FilBot3
Too bad, I don't have access to an azure devops environment so I can't actually debug the problem. The only thing I can add is that if you use poetry and set it up, you for sure don't need twine or pip.Arne
This is true. You do not need twine or pip to upload packages. However, pip is probably already installed with your installation.FilBot3
@FilBot3 did you figure out what you needed to do?Joshua Olson

1 Answers

1
votes

To narrow down the issue, you may try the following items:

  1. Try to create a new PAT with Full access, and then try it again.
  2. Try to run command poetry publish -u $(username) -p $(password) ...

The $(username) can be anything, except blank. Remember to also use the -r option to define your repository.