Skip to main content

Automatically retrieve credentials for AWS CodeArtifact.

Project description

AWS CodeArtifact Keyring Backend

The keyrings.codeartifact package provides authentication for publishing and consuming packages within a private PyPi repository hosted on AWS CodeArtifact; it contains an extension to the keyring library that will automatically inject a time-limited access token.

Installation

To install this package, install the "keyrings.codeartifact" package using pip:

pip install keyrings.codeartifact

Usage

The keyring library has been integrated with recent versions of pip and twine. Once installed, this library will automatically supply credentials whenever pip/twine (or other keyring-enabled package) attempts to use a repository hosted within CodeArtifact. It will use any appropriate AWS credentials provided in ~/.aws/credentials by default.

--index-url https://${DOMAIN}-${ACCOUNT}.d.codeartifact.${REGION}.amazonaws.com/pypi/${REPOSITORY}/simple/

Config

This backend provides a number of configuration options to modify the behaviour of the AWS client.

The configuration options can be specified within [codeartifact] sections of the keyringrc.cfg.

Run keyring diagnose to find its as the location; it varies between different platforms.

Available options:

  • profile_name: Use a specific AWS profile to authenticate with AWS.
  • token_duration: Validity period (in seconds) for retieved authorization tokens.
  • aws_access_key_id: Use a specific AWS access key to authenticate with AWS.
  • aws_secret_access_key: Use a specific AWS secret access key to authenticate with AWS.

For more explanation of these options see the AWS CLI documentation.

Single Section Configuration

A trivial example keyringrc.cfg section for a single account:

[codeartifact]
# Tokens should only be valid for 30 minutes.
token_duration=1800

# Use the 'default' profile name.
profile_name=default

# Use the following access keys.
aws_access_key_id=xxxxxxxxx
aws_secret_access_key=xxxxxxxxx

Multiple Section Configuration (EXPERIMENTAL)

This backend can use multiple sections to select different configuration values.

Each section may also have any of the following "qualifiers" in any order:

  • domain: Matches on the repository domain.
  • account: Matches on the repository account.
  • region: Matches on the repository region.
  • name: Matches on the repository name.

When looking up a CodeArtifact URL, each matching qualifier ranks that section higher.

The section with highest score (ie: the most specific match) will be selected for that URL.

When configured in this manner, the codeartifact section will specify default values.

An example of a more advanced configuration for using multiple sections:

# These are the defaults for other sections.
[codeartifact]
token_duration=1800

# Use for any repositories in account 000000000000.
[codeartifact account="000000000000"]
profile_name=special_profile

# Use for account 999999999999 with a repository named "staging".
[codeartifact account="999999999999" name="staging"]
profile_name=staging_profile

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyrings_codeartifact-2.1.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keyrings_codeartifact-2.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file keyrings_codeartifact-2.1.1.tar.gz.

File metadata

  • Download URL: keyrings_codeartifact-2.1.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for keyrings_codeartifact-2.1.1.tar.gz
Algorithm Hash digest
SHA256 028cd754e9bdb7638bb256cfd5fb0bb1440d71edc46d9e08995cdd22d6ad2a6c
MD5 014b09b0e0edfd0f17ff5ac8a7160cde
BLAKE2b-256 bf021d74e0dc670c92ef831176d6ec20203b6014936f8e62b7d0191f52aeecbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for keyrings_codeartifact-2.1.1.tar.gz:

Publisher: release.yml on jmkeyes/keyrings.codeartifact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keyrings_codeartifact-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for keyrings_codeartifact-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f06ee200c9981051165cc1d41ec2e4a4ebea8457f44724c577e2d428659d3761
MD5 a952069900a6e9e7d3dae176afc00d10
BLAKE2b-256 af336b0313b6099c192bd128d689329398c341fcb0c11c9b38d248060153dd5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for keyrings_codeartifact-2.1.1-py3-none-any.whl:

Publisher: release.yml on jmkeyes/keyrings.codeartifact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page