I'm a bit of a beginner to working with Poetry and Azure, so forgive me in advance for any syntax errors and lack of terminology
I built a python package called 'npipack' stored in Azure DevOps: https://dev.azure.com/NPIDemandPlanning/npipack
Now, I created a local (I mean, locally in my laptop) python-based project where the dependecies and venv are managed by Poetry. I would like to add 'npipack' package inside the project as well.
Here the step I followed:
echo $AZURE_DEVOPS_PAT
returns the correct PATpyproject.toml
file automatically created by Poetry and I added the following code[[tool.poetry.source]]
name = "azure"
url = "https://${AZURE_DEVOPS_PAT}@pkgs.dev.azure.com/NPIDemandPlanning/_packaging/npi-pack-feed/pypi/simple/"
default = false
poetry config repositories.azure https://<MY_PAT>@pkgs.dev.azure.com/NPIDemandPlanning/_packaging/npi-pack-feed/pypi/simple
poetry config http-basic.azure <MY_USERNAME> <MY_PAT>
artifacts-keyring
via the command poetry self add artifacts-keyring
poetry add npipack --source azure
. Here is where I get an Authorization error(base) (update sales & forecast report-py3.11) bash-3.2$ poetry add npipack --source azure
Source (azure): Authorization error accessing https://${AZURE_DEVOPS_PAT}@pkgs.dev.azure.com/NPIDemandPlanning/_packaging/npi-pack-feed/pypi/simple/npipack/
Here other useful information:
Did you experince something similar? Could please help me to solve the Authorization error?
As far as I tested, we didn't need to retrieve the credentials stored in keyring when the poetry.source.url already contained the PAT in plaintext for authentication. You may test disabling it to rule out the cause by the PAT.
poetry config keyring.enabled false
poetry source add --priority=explicit azure https://xxxMyPATxxx@pkgs.dev.azure.com/<MyADOOrgName>/_packaging/npi-pack-feed/pypi/simple/
poetry add npipack --source azure
In addition, as suggested in the Poetry document, you may use environment variable POETRY_HTTP_BASIC_AZURE_PASSWORD
to provide the credentials
poetry source add --priority=explicit azure https://pkgs.dev.azure.com/<MyADOOrgName>/_packaging/npi-pack-feed/pypi/simple/
export POETRY_HTTP_BASIC_AZURE_PASSWORD="xxxMyPATxxx"
poetry add npipack --source azure