Skip to content

Commit 3e8b09b

Browse files
authored
Merge pull request #8081 from MicrosoftDocs/artifacts/444200
pip & twine tutorial
2 parents 9b0f0db + f9ea690 commit 3e8b09b

File tree

1 file changed

+32
-38
lines changed

1 file changed

+32
-38
lines changed
Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
11
---
2-
title: Get started with Python packages in Azure Artifacts
3-
description: Learn how to set up your project and manage your Python packages in Azure Artifacts.
2+
title: Publish and download Python packages with Azure Artifacts
3+
description: Learn how to configure your project to publish and download Python packages with Azure Artifacts.
44
ms.service: azure-devops-artifacts
55
ms.topic: quickstart
6-
ms.date: 12/03/2024
6+
ms.date: 07/02/2025
77
monikerRange: "<=azure-devops"
88
ms.custom: devx-track-python, py-fresh-zinc, engagement-fy23
99
"recommendations": "true"
1010
---
1111

12-
# Get started with Python packages in Azure Artifacts
12+
# Publish and download Python packages with Azure Artifacts
1313

1414
[!INCLUDE [version-gt-eq-azure-devops-2019](../../includes/version-gt-eq-2019.md)]
1515

16-
Using Azure Artifacts, you can publish and download packages from feeds and public registries such as PyPi. This quickstart will guide you through creating a feed, configuring your project, and managing Python packages in your Azure Artifacts feed. In this article, you learn how to:
17-
18-
> [!div class="checklist"]
19-
>
20-
> * Create a new feed.
21-
> * Authenticate with your feed.
22-
> * Publish Python packages.
23-
> * Install packages from your feed.
16+
Using Azure Artifacts, you can publish and download packages from feeds and public registries such as PyPi. This quickstart guides you through creating a feed, configuring your project, and managing Python packages in your Azure Artifacts feed.
2417

2518
## Prerequisites
2619

27-
- Create an Azure DevOps [organization](../../organizations/accounts/create-organization.md) and a [project](../../organizations/projects/create-project.md#create-a-project) if you haven't already.
28-
29-
- Download and install [Python](https://www.python.org/downloads/).
20+
| **Product** | **Requirements** |
21+
|--------------------|----------------------|
22+
| **Azure DevOps** | - An Azure DevOps [organization](../../organizations/accounts/create-organization.md).<br>- An Azure DevOps [project](../../organizations/projects/create-project.md).<br> - Download and install [Python](https://www.python.org/downloads/). |
3023

3124
## Get the code
3225

33-
1. If you don't have your own Python project, you can use the following sample Python project:
26+
1. If you don't have your own Python project, you can use the following sample Python project. Otherwise, you can skip to the next section:
3427

3528
```
36-
https://github.com/microsoft/python-package-template
29+
https://github.com/Azure-Samples/azure-stack-hub-flask-hello-world
3730
```
3831
3932
1. To build your wheel and source distribution, run the following commands in your project directory:
@@ -43,7 +36,7 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
4336
python -m build
4437
```
4538
46-
1. If your Python project has a *setup.py* file, you can also use this command to build your package:
39+
1. If your Python project has a *setup.py* file, you can also build your package using:
4740
4841
```
4942
python setup.py sdist bdist_wheel
@@ -53,19 +46,19 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
5346
5447
[!INCLUDE [](../includes/create-feed.md)]
5548
56-
## Connect to a feed
49+
## Connect to your feed
5750
5851
#### [twine](#tab/twine)
5952
6053
1. Sign in to your Azure DevOps organization, and then navigate to your project.
6154
6255
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
6356
64-
1. Select **twine** under the **Python** section.
57+
1. Under the **Python** section, select **twine**.
6558
66-
1. If this is your first time using Azure Artifacts with twine, select **Get the tools** and follow the steps to install the prerequisites.
59+
1. If this is your first time using Azure Artifacts with twine, select **Get the tools** and follow the instructions to download Python and install Twine and the artifacts keyring.
6760
68-
1. Add a *pypirc* file to your home directory and paste the provided snippet. Your file should look like this:
61+
1. Create a *pypirc* file in your home directory and paste the snippet provided in the **Project setup** section. Your file should look like this:
6962
7063
```
7164
[distutils]
@@ -77,21 +70,21 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
7770
```
7871
7972
> [!NOTE]
80-
> If your *.pypirc* file already contains credentials for the public PyPI index, we recommend removing the `[pypi]` section to prevent accidental publication of private packages to PyPI.
73+
> If your *.pypirc* file already includes credentials for the public PyPI index, we recommend removing the `[pypi]` section to avoid accidentally publishing private packages to PyPI.
8174
8275
#### [pip](#tab/pip)
8376
8477
1. Sign in to your Azure DevOps organization, and then navigate to your project.
8578
8679
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
8780
88-
1. Select **pip** under the **Python** section.
81+
1. Under the **Python** section, select **pip**.
8982
90-
1. If this is your first time using Azure Artifacts with pip, select **Get the tools** and follow the steps to install the prerequisites.
83+
1. If this is your first time using Azure Artifacts with pip, select **Get the tools** and follow the instructions to download Python, update pip, and install the keyring.
9184
9285
1. [Create a virtual environment](https://docs.python.org/3/library/venv.html).
9386
94-
1. Add a *pip.ini* file (Windows) or *pip.conf* file (Mac/Linux) to your virtual environment and paste the provided snippet into it. Your file should resemble the following:
87+
1. Add a *pip.ini* file (Windows) or *pip.conf* file (Mac/Linux) to your virtual environment, and paste the provided snippet into it. Your file should resemble the following:
9588
9689
```
9790
[global]
@@ -100,39 +93,40 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
10093
10194
- - -
10295
103-
## Publish packages
96+
## Publish packages to your feed
10497
105-
1. Run this command in your project directory to create source and wheel distributions:
98+
1. In your project directory, run the following command to create source and wheel distributions:
10699
107100
```
108101
python setup.py sdist bdist_wheel
109102
110103
```
111104
112-
1. Run the following command to publish your package. Use the -r *FEED_NAME* flag to ensure your private packages are not accidentally published to PyPI.
105+
1. To publish your package, use the command below. Be sure to use the -r *FEED_NAME* flag to avoid accidentally publishing to PyPI:
113106
114107
```
115108
twine upload -r <FEED_NAME> dist/*
116109
```
117110
118-
## Install packages
111+
## Install packages from your feed
119112
120-
1. Run this command in your project directory to install your packages:
113+
1. To install packages from your feed, run the following command in your project directory:
121114
122115
```
123116
pip install
124117
```
125118
126-
1. To install a specific package, run the following command, replacing the placeholder with the package name from your feed.
119+
1. To install a specific package, replace the placeholder with the package name from your feed:
127120
128-
```Command
121+
```
129122
pip install <PACKAGE_NAME>
130123
```
131124
132-
## Next steps
125+
## Related content
126+
127+
- [Set up upstream sources](../how-to/set-up-upstream-sources.md)
128+
129+
- [Use packages from Python package index (PyPI)](../python/use-packages-from-pypi.md)
133130
134-
> [!div class="nextstepaction"]
135-
> [Use packages from Python package index (PyPI)](../python/use-packages-from-pypi.md)
136-
> [Set up upstream sources](../how-to/set-up-upstream-sources.md)
137-
> [Publish Python packages with Azure Pipelines](../../pipelines/artifacts/pypi.md)
131+
- [Publish Python packages with Azure Pipelines YAML/Classic](../../pipelines/artifacts/pypi.md)
138132

0 commit comments

Comments
 (0)