Skip to content

Instantly share code, notes, and snippets.

@smparekh
Last active May 10, 2022 16:52
Show Gist options
  • Save smparekh/a2bf43e514f65b920c8ca8fb55aaefbb to your computer and use it in GitHub Desktop.
Save smparekh/a2bf43e514f65b920c8ca8fb55aaefbb to your computer and use it in GitHub Desktop.
Using CodeArtifact as Pypi mirror for Pipenv
set -x AWS_PROFILE default # replace
set -x AWS_REGION us-east-1 # replace
set -x CODEARTIFACT_DOMAIN foo # replace
set -x CODEARTIFACT_DOMAIN_ID 123456789 # replace
set -x CODEARTIFACT_REPOSITORY somepypi # replace
function codeartifact_login
set -Ux CODEARTIFACT_TOKEN (aws --profile $AWS_PROFILE codeartifact get-authorization-token --domain $CODEARTIFACT_DOMAIN --domain-owner $CODEARTIFACT_DOMAIN_ID --query authorizationToken --output text)
set -Ux PIPENV_PYPI_MIRROR "https://aws:$CODEARTIFACT_TOKEN@$CODEARTIFACT_DOMAIN-$CODEARTIFACT_DOMAIN_ID.d.codeartifact.$AWS_REGION.amazonaws.com/pypi/$CODEARTIFACT_REPOSITORY/simple/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment