This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018
This guide will walk you through using Azure Artifacts to publish and consume Python packages to and from your feed.
Create a feed
Sign in to your Azure DevOps organization, and then navigate to your project.
Select
Artifacts
, and then select
Create Feed
.
Azure Artifacts comes pre-installed in TFS 2018. If this is the first time using your feed, you might be asked to
assign a license
Go to
Build & Release
and select
Packages
.
Connect to feed
There are two primary ways to connect to a feed to publish or consume your Python packages:
Install and use the
artifacts-keyring
package, which will automatically set up authentication for you.
Manually set up credentials for your
.pypirc
pushes, and your
pip.ini
/
pip.conf
for pulls with a personal access token (PAT).
artifacts-keyring
is not supported on newer versions of Ubuntu.
Use artifacts-keyring to set up authentication
The
artifacts-keyring
package allows you to set up authentication to publish and consume your Python packages to and from your feed. Both
pip
and
twine
use the Python
keyring library
to find credentials.
Important
You must have pip 19.2 and twine 1.13.0 or higher to use
artifacts-keyring
. See
Usage requirements
for more details.
In an elevated command prompt window, run the following command to install the artifacts-keyring package:
pip install artifacts-keyring
To install a package from your feed, run the following command:
Project scoped feed:
pip install <PACKAGE_NAME> --index-url https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/pypi/simple
Organization scoped feed:
pip install <PACKAGE_NAME> --index-url https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/simple
Project scoped feed:
twine upload --repository-url https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/pypi/upload
Organization scoped feed:
twine upload --repository-url https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/upload
The artifacts-keyring package is layered on top of the Azure Artifacts Credential Provider. For more advanced configuration options, check out the artifacts-credprovider repository.
Create a Personal access token with Packaging > Read scope to authenticate with Azure DevOps.
Select Artifacts, and then select your feed then select Connect to feed.
If this is your first time using Azure Artifacts with twine, select Get the tools to download and install the prerequisites.
Create a virtualenv, if you don't already have one.
Add a pip.ini (Windows) or a pip.conf (Mac/Linux) file to your virtualenv. Make sure you don't check your personal access token into a public repository.
Project scoped feed:
[global]
extra-index-url=https://<FEED_NAME>:<YOUR_PERSONAL_ACCESS_TOKEN>@pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/pypi/simple/
Organization scoped feed:
[global]
extra-index-url=https://<FEED_NAME>:<YOUR_PERSONAL_ACCESS_TOKEN>@pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/pypi/simple/
When you connect to Azure DevOps for the first time, you'll be prompted for credentials. Enter your user name(any string) and your personal access token in the appropriate fields. The credentials will be cached locally and used to automatically sign you in the next time you use the service.
If you want to publish or consume your packages using Azure Pipelines, use the Python Pip Authenticate task to authenticate and install packages, or the Python Twine Upload Authenticate task to publish your packages.
Related articles
Publish Python packages with Azure Pipelines.
Publish and consume Python packages from the command line
Build Python apps.