Skip to content

Commit 0e08dad

Browse files
committedNov 21, 2024
python pip
1 parent aaf6ef1 commit 0e08dad

File tree

1 file changed

+17
-117
lines changed

1 file changed

+17
-117
lines changed
 

Diff for: ‎docs/artifacts/quickstarts/python-cli.md

+17-117
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ monikerRange: '>= azure-devops-2019'
1313

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

16-
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:
1717

1818
> [!div class="checklist"]
1919
> * Create an new feed.
@@ -66,134 +66,34 @@ Azure Artifacts enables developers to manage their dependencies from a single fe
6666
> [!IMPORTANT]
6767
> 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.
6868
69-
## Consume Python packages
69+
## Install packages
7070
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:
124-
125-
```Command
126-
pip install <PACKAGE_NAME> --index-url <INDEX_URL>
127-
```
128-
129-
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.
17572
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**.
17774
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.
17976
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).
18178
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:
18380
18481
```
18582
[global]
186-
index-url=https://<FEED_NAME>:<YOUR_PERSONAL_ACCESS_TOKEN>@<FEED_URL>
83+
index-url=https://pkgs.dev.azure.com/ramiMSFTDevOps/HelloNode/_packaging/HelloNodeFeed/pypi/simple/
18784
```
18885
189-
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:
19087
191-
```Command
192-
pip install <PACKAGE_NAME>
88+
```
89+
pip install
19390
```
19491
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.
19694
197-
- [Configure permissions](../feeds/feed-permissions.md)
198-
- [Understand upstream sources](../concepts/upstream-sources.md)
95+
## Related content
96+
97+
- [Use packages from PyPi](../python/use-packages-from-pypi.md)
19998
- [Publish Python packages with Azure Pipelines](../../pipelines/artifacts/pypi.md)
99+
- [Configure permissions](../feeds/feed-permissions.md)

0 commit comments

Comments
 (0)