title | description | ms.service | ms.topic | ms.date | monikerRange |
---|---|---|---|---|---|
Connect your Python project to an Azure Artifacts feed |
Lean how to set up your Python project and connect to an Azure Artifacts feed. |
azure-devops-artifacts |
how-to |
01/24/2025 |
>= azure-devops-2019 |
[!INCLUDE version-gt-eq-azure-devops-2019]
This article guides you through setting up your Python project and connecting to an Azure Artifacts feed.
Product | Requirements |
---|---|
Azure DevOps | - An Azure DevOps organization. - An Azure DevOps project. - Download and install Python. |
If this is your first time using Azure Artifacts on this machine, run the following command to install the Azure Artifacts keyring, required for authenticating with Azure Artifacts feeds:
pip install keyring artifacts-keyring
Follow the steps below to set up your project and connect to your feed.
Make sure you have the latest version of pip python -m pip install --upgrade pip
and if you're using Linux, ensure you've installed the prerequisites required for the credential manager.
-
Sign in to your Azure DevOps organization, and navigate to your project.
-
Select Artifacts, and then select your feed from the dropdown menu.
-
Select Connect to feed, and then select pip from the left.
-
Create a virtual environment if you don't have one already.
-
Add a pip.ini (Windows) or pip.conf (Mac/Linux) file to your virtualenv and paste the provided snippet from the Project setup section into the file. Your config file should look similar to the following snippet:
[global] index-url=https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/pypi/simple/
Note
You need pip version 19.2 or higher to use artifacts-keyring. For more information, see Usage requirements.
Make sure you've installed Twine p install twine
and if you're using Linux, ensure you've installed the prerequisites required for the credential manager.
-
Sign in to your Azure DevOps organization, and navigate to your project.
-
Select Artifacts, and then select your feed from the dropdown menu.
-
Select Connect to feed, and then select Twine from the left.
-
Add a .pypirc file to your home directory and paste the provided snippet from the Project setup section into the file. Your config file should look similar to the following snippet:
[!NOTE] If your config file contains credentials for the public PyPI index, we recommend removing the [pypi] section to prevent accidentally publishing private packages to the public registry.
[distutils] Index-servers = FEED_NAME [FEED_NAME] Repository = https://pkgs.dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_packaging/FEED_NAME/pypi/upload/
Note
You need Twine 1.13.0 or higher to use artifacts-keyring. For more information, see Usage requirements.
[!div class="nextstepaction"] Publish Python packages