I have been following a tutorial for publishing a Python package, which is only meant to be used by the members of my organisation, to Azure DevOps Artifacts (link).
I use an azure pipeline:
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
displayName: 'Use Python 3.7'
- script: |
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools twine
python -m build
pip install -r requirements.txt
displayName: 'Install dependencies'
- script: |
pip install pytest pytest-azurepipelines
pytest
displayName: 'pytest'
# Publish code to a previously created feed
- task: TwineAuthenticate@1
inputs:
artifactFeed: feed-name
- script: |
python -m twine upload -r feed-name --config-file $(PYPIRC_PATH) dist/*.whl
but the CmdLine
step of the pipeline fails with the following error message:
Received "500: Internal Server Error - Failed to retrieve data from the upstream package source 'https://pypi.org/': Forbidden (Forbidden) (DevOps Activity ID: some-id-string)"
I have also tried using Microsoft's suggested way of building the package locally and pushing it to Artifacts using feed-name
, but it fails with the exact same message.
Questions:
- Has this ever happened to you, and how did you fix it?
- Why is it using https://pypi.org/ as an upstream package source when I have the code locally, so nothing exists on pypi regarding this package?
- Why is it even mentioning https://pypi.org/ when I want my package to be restricted to the members of my organisation only? Maybe I don't have to use
twine
?