Skip to content

Commit

Permalink
add docs for AWS CodeArtifact (#6816)
Browse files Browse the repository at this point in the history
<!--
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>
  • Loading branch information
fmariluis and zanieb committed Aug 29, 2024
1 parent f2ce805 commit 670e960
Showing 1 changed file with 55 additions and 2 deletions.
57 changes: 55 additions & 2 deletions docs/guides/integration/alternative-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 670e960

Please sign in to comment.