add docs for AWS CodeArtifact (#6816)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This adds explicit information about using `uv` with AWS CodeArtifact
(both as an extra index to fetch private packages and also to publish
packages using `twine`).

## Test Plan

I'm currently using this setup with several private projects that use
CodeArtifact.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Franco Mariluis
2024-08-29 14:40:41 -03:00
committed by GitHub
parent f2ce80589f
commit 670e9603ee
+55 -2
View File
@@ -56,7 +56,60 @@ $ # Configure the index URL with the username
$ export UV_EXTRA_INDEX_URL=https://VssSessionToken@pkgs.dev.azure.com/{organisation}/{project}/_packaging/{feedName}/pypi/simple/
```
## AWS CodeArtifact
uv can install packages from
[AWS CodeArtifact](https://docs.aws.amazon.com/codeartifact/latest/ug/using-python.html).
The authorization token can be retrieved using the `awscli` tool.
!!! note
This guide assumes the AWS CLI has previously been authenticated.
First, declare some constants for your CodeArtifact repository:
```bash
export AWS_DOMAIN="<your-domain>"
export AWS_ACCOUNT_ID="<your-account-id>"
export AWS_REGION="<your-region>"
export AWS_CODEARTIFACT_REPOSITORY="<your-repository>"
```
Then, retrieve a token from the `awscli`:
```bash
export AWS_CODEARTIFACT_TOKEN="$(
aws codeartifact get-authorization-token \
--domain $AWS_DOMAIN \
--domain-owner $AWS_ACCOUNT_ID \
--query authorizationToken \
--output text
)"
```
And configure the index URL:
```bash
export UV_EXTRA_INDEX_URL="https://aws:${AWS_CODEARTIFACT_TOKEN}@${AWS_DOMAIN}-${AWS_ACCOUNT_ID}.d.codeartifact.${AWS_REGION}.amazonaws.com/pypi/${AWS_CODEARTIFACT_REPOSITORY}/simple/"
```
### Publishing packages
If you also want to publish your own packages to AWS CodeArtifact, you can use `twine` as described
in the [publishing guide](../publish.md). You will need to set `TWINE_REPOSITORY_URL` separately
from the credentials:
```bash
# Configure twine to use AWS CodeArtifact
export TWINE_REPOSITORY_URL="https://${AWS_CODEARTIFACT_TOKEN}@${AWS_DOMAIN}-${AWS_ACCOUNT_ID}.d.codeartifact.${AWS_REGION}.amazonaws.com/pypi/${AWS_CODEARTIFACT_REPOSITORY}/"
export TWINE_USERNAME=aws
export TWINE_PASSWORD="$AWS_CODEARTIFACT_TOKEN"
# Publish the package
uv run twine upload dist/*
```
## Other indexes
uv is also known to work with JFrog's Artifactory, the Google Cloud Artifact Registry, and AWS Code
Artifact.
uv is also known to work with JFrog's Artifactory and the Google Cloud Artifact Registry.