You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
24
17
25
18
## Prerequisites
26
19
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/).|
30
23
31
24
## Get the code
32
25
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:
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
43
36
python -m build
44
37
```
45
38
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:
47
40
48
41
```
49
42
python setup.py sdist bdist_wheel
@@ -53,19 +46,19 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
53
46
54
47
[!INCLUDE [](../includes/create-feed.md)]
55
48
56
-
## Connect to a feed
49
+
## Connect to your feed
57
50
58
51
#### [twine](#tab/twine)
59
52
60
53
1. Sign in to your Azure DevOps organization, and then navigate to your project.
61
54
62
55
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
63
56
64
-
1. Select **twine** under the **Python** section.
57
+
1. Under the **Python** section, select **twine**.
65
58
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.
67
60
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:
69
62
70
63
```
71
64
[distutils]
@@ -77,21 +70,21 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
77
70
```
78
71
79
72
> [!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.
81
74
82
75
#### [pip](#tab/pip)
83
76
84
77
1. Sign in to your Azure DevOps organization, and then navigate to your project.
85
78
86
79
1. Select **Artifacts**, select your feed from the dropdown menu, and then select **Connect to feed**.
87
80
88
-
1. Select **pip** under the **Python** section.
81
+
1. Under the **Python** section, select **pip**.
89
82
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.
91
84
92
85
1. [Create a virtual environment](https://docs.python.org/3/library/venv.html).
93
86
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:
95
88
96
89
```
97
90
[global]
@@ -100,39 +93,40 @@ Using Azure Artifacts, you can publish and download packages from feeds and publ
100
93
101
94
- - -
102
95
103
-
## Publish packages
96
+
## Publish packages to your feed
104
97
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:
106
99
107
100
```
108
101
python setup.py sdist bdist_wheel
109
102
110
103
```
111
104
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:
113
106
114
107
```
115
108
twine upload -r <FEED_NAME> dist/*
116
109
```
117
110
118
-
## Install packages
111
+
## Install packages from your feed
119
112
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:
121
114
122
115
```
123
116
pip install
124
117
```
125
118
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:
127
120
128
-
```Command
121
+
```
129
122
pip install <PACKAGE_NAME>
130
123
```
131
124
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)
133
130
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)
0 commit comments