1

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:

  1. Has this ever happened to you, and how did you fix it?
  2. 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?
  3. 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?
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
  • 1
    I just ran into this issue myself, but had no such problem on 9/27 (deployed successfully many times before with same setup). Is it possible something changed in Azure Artifacts or PyPi? – evan.oman Oct 01 '22 at 02:10

1 Answers1

1

I ran into the same problem after being able to release just two days ago with the same setup.py, Artifact Feed, etc.

It looks like the issue might have to do with a connection problem between Azure DevOps Artifacts and PyPi? I went into Feed Settings > Upstream Sources and saw this:

Upstream Sources Screen

Clicking the error link showed me this modal popup:

Error Message

which isn't too helpful, and is also strange since it seems like pypi.org is up and running just fine (checked here: https://status.python.org/).

I don't see any option to refresh upstream sources and when I tried adding a new source, it didn't give me an option to add a new Python source (just npm).

So I guess I will just have to hope that this truly is a transient issue that will resolve itself over the weekend.

Update 10/1/2022

I retried my twine upload call today and I was able to release without any issues -- the issue appears to have been transient.

evan.oman
  • 5,922
  • 22
  • 43