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
Azure Artifacts enables developers to manage their dependencies from a single feed. You can publish and consume Python packages to your feed from the command line. In this article, you'll learn how to:
16
+
Azure Artifacts enables developers to manage their dependencies from a single feed. You can publish and consume Python packages to and from your feed using the command line. In this article, you'll learn how to:
17
17
18
18
> [!div class="checklist"]
19
19
> * Create an new feed.
@@ -66,134 +66,34 @@ Azure Artifacts enables developers to manage their dependencies from a single fe
66
66
> [!IMPORTANT]
67
67
> You must have twine 1.13.0 or higher to use **artifacts-keyring**. See [Usage requirements](https://github.com/microsoft/artifacts-keyring#requirements) for more details.
68
68
69
-
## Consume Python packages
69
+
## Install packages
70
70
71
-
You can consume Python packages from your feed using the artifacts-keyring package or PAT authentication.
72
-
73
-
### Consume packages with artifacts-keyring
74
-
75
-
1. In your project, select **Artifacts** and then select your feed.
76
-
77
-
1. Select **Connect to feed**.
78
-
79
-
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="A screenshot highlighting the connect to feed button.":::
80
-
81
-
1. Select **pip** under the **Python** section.
82
-
83
-
:::image type="content" source="./media/pip-feed.png" alt-text="A screenshot of pip selection in Connect to feed.":::
84
-
85
-
1. Prepare your local Python environment.
86
-
87
-
# [Windows](#tab/Windows)
88
-
89
-
1. Ensure pip is installed and up to date:
90
-
91
-
```Command
92
-
python -m pip install --upgrade pip
93
-
```
94
-
95
-
1. To create and activate a Python virtual environment:
96
-
97
-
```Command
98
-
python -m venv myenv
99
-
myenv/Scripts/activate
100
-
```
101
-
102
-
# [Linux and macOS](#tab/LinuxMac)
103
-
104
-
1. Ensure pip is installed and up to date:
105
-
106
-
```Command
107
-
python3 -m pip install --upgrade pip
108
-
```
109
-
110
-
1. To create and activate a Python virtual environment:
111
-
112
-
```Command
113
-
python3 -m venv myenv
114
-
source myenv/bin/activate
115
-
```
116
-
117
-
---
118
-
119
-
1. Copy the `index-url` from the **Project setup** section of the **Connect to feed** dialog.
120
-
121
-
:::image type="content" source="./media/screenshot-pip-connect-to-feed-index-url.png" alt-text="A screenshot of the index-url in the Connect to feed dialog.":::
122
-
123
-
1. To install a package from your feed, run the following command replacing \<PACKAGE_NAME\> with the package name from your feed and \<INDEX_URL\> with the index url you copied from the **Connect to feed** dialog:
When you connect to Azure DevOps for the first time, you're 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.
130
-
131
-
### Consume packages with PAT authentication
132
-
133
-
1. Go to your Azure DevOps Project and select **Artifacts**.
134
-
1. Select your feed and select **Connect to feed**.
135
-
136
-
:::image type="content" source="../media/connect-to-feed-azure-devops-newnav.png" alt-text="A screenshot highlighting the connect to feed button.":::
137
-
138
-
1. Select **pip** under the **Python** section.
139
-
140
-
:::image type="content" source="media/pip-feed.png" alt-text="A screenshot highlighting the pip package type.":::
141
-
142
-
1. Prepare your local Python environment.
143
-
144
-
# [Windows](#tab/Windows)
145
-
146
-
1. Ensure pip is installed and up to date:
147
-
148
-
```Command
149
-
python -m pip install --upgrade pip
150
-
```
151
-
152
-
1. Create and activate a Python virtual environment:
153
-
154
-
```Command
155
-
python -m venv myenv
156
-
myenv/Scripts/activate
157
-
```
158
-
159
-
# [Linux and macOS](#tab/LinuxMac)
160
-
161
-
1. Ensure pip is installed and up to date:
162
-
163
-
```Command
164
-
python3 -m pip install --upgrade pip
165
-
```
166
-
167
-
1. To create and activate a Python virtual environment:
168
-
169
-
```Command
170
-
python3 -m venv myenv
171
-
source myenv/bin/activate
172
-
```
173
-
174
-
---
71
+
1. Sign in to your Azure DevOps organization, and then navigate to your project.
175
72
176
-
1. Add a *pip.ini* (Windows) or a *pip.conf* (Mac/Linux) file to the root directory of your virtual environment. Copy the content from the **Project setup** section of the **Connect to feed** dialog and add it to your *pip.ini* or *pip.conf* file.
73
+
1. Select **Artifacts**, and then select **Connect to feed**.
177
74
178
-
:::image type="content" source="./media/screenshot-pip-connect-to-feed-pip-ini.png" alt-text="A screenshot highlighting the pip.ini file content.":::
75
+
1. Select **pip** from the left navigation area. If this is your first time using Azure Artifacts with pip, make sure to install the prerequisites by selecting **Get the tools** and following the provided steps.
179
76
180
-
1. To avoid needing to enter your personal access token every time you install a package from your feed, you can add your credentials to the *pip.ini* or *pip.conf* file. Make sure you don't check your personal access token into a public repository.
77
+
1. [Create a virtual environment](https://docs.python.org/3/library/venv.html).
181
78
182
-
Example of a *pip.ini* or *pip.conf* file with credentials:
79
+
1. Add a *pip.ini* (Windows) or *pip.conf* (Mac/Linux) file to your virtualenv and paste the provided snippet into it. Your file should look similar to the following snippet:
1. To install your package, run the following command replacing \<PACKAGE_NAME\> with the package name from your feed.
86
+
1. Run this command in your project directory to install your packages:
190
87
191
-
```Command
192
-
pip install <PACKAGE_NAME>
88
+
```
89
+
pip install
193
90
```
194
91
195
-
## Related articles
92
+
> [!IMPORTANT]
93
+
> You must have pip 19.2 or higher to use **artifacts-keyring**. See [Usage requirements](https://github.com/microsoft/artifacts-keyring#requirements) for more details.
0 commit comments