Skip to main content

CodeArtifact utilties for Poetry

Project description

partifact

partifact is a tool to help with configuring and authenticating CodeArtifact as a repository for Poetry and pip.

AWS CLI offers functionality to configure CodeArtifact for pip. This tool offers the following improvements over the CLI:

  1. Poetry support.
  2. Assuming an AWS role to get the token. This is handy in automated pipelines, which may have the access key and secret key as environment variables, but want to install packages from CodeArtifact on a different account.
  3. Configuration persisted in a config file, making the tool more convenient to use than the CLI with the options it requires to be passed in from the command line.

How to use it?

Install partifact from pypi using pip the usual way:

pip install partifact

It's best to do this globally, rather than inside the virtualenv.

Before you can use partifact, the Poetry source repository needs to be configured in pyproject.toml.

[[tool.poetry.source]]
name = "my-repo"
url = "https://{code_artifact_domain}-{aws_account}.d.codeartifact.{aws_region}.amazonaws.com/pypi/{code_artifact_repository}/simple/"
default = true  # if this should be the default repository to install from

If you are publishing to the repository, the /simple/ suffix is not required at the end.

Once Poetry is configured, you can use the partifact command to authenticate:

partifact login my-repo

NOTE: Make sure your run the command from the directory where your pyproject.toml is!

Optionally, you can pass in an AWS profile and/or AWS role to use for CodeArtifact token generation.

partifact login myrepo --profile myprofile
partifact login myrepo --role myrole

If you would also like to configure global.index-url in the pip config, you can do so through the --configure-pip flag.

partifact login myrepo --profile myprofile --configure-pip

Known issues

  1. The CodeArtifact token seems to exceed the maximum length allowed in Windows Credential Manager, resulting in a misleading (1783, 'CredWrite', 'The stub received bad data.') error. The library has been tested on macOS.

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

partifact-0.4.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

partifact-0.4.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file partifact-0.4.0.tar.gz.

File metadata

  • Download URL: partifact-0.4.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.0 Linux/6.11.0-1018-azure

File hashes

Hashes for partifact-0.4.0.tar.gz
Algorithm Hash digest
SHA256 cbaa879fcfc709598f3f54ac4f518775a368b8b507675cf779a9d0274bed4969
MD5 d756e34d38403c9c0e44d16b9f15407e
BLAKE2b-256 3c1b2f856e0887f42debddf8109468050c67b86280ff57257e1d3ca0a247db70

See more details on using hashes here.

File details

Details for the file partifact-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: partifact-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.0 Linux/6.11.0-1018-azure

File hashes

Hashes for partifact-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0c9797e46897f8257d76dfd4aebc1ff9ddd55b04d3bce6fbfb5167648f9b9c8
MD5 f4733b7fbf8c5dcae93072dbea181d22
BLAKE2b-256 6d5bbf6e7cc53eaa786938d2a8c6cd74c9a6d37ce31869bd65c7a33315d3a9ac

See more details on using hashes here.

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