Skip to main content

keyring backend for GitLab package indexes

Project description

keyring-gitlab-pypi is a backend for keyring which recognises GitLab package registry URLs.

It is designed for use with uv.

How to use

  1. Install keyring with this backend

    uv tool install keyring --with keyring-gitlab-pypi
    
  2. Create a personal access token with read_api scope and add it to ~/.config/gitlab-pypi.toml:

    ["https://gitlab.com"]
    token = "<token>"
    
  3. Configure keyring-provider in uv:

    • using an environment variable:

      export UV_KEYRING_PROVIDER=subprocess
      
    • or in uv.toml:

      keyring-provider = "subprocess"
      
    • or using the option

      uv sync --keyring-provider=subprocess
      
  4. Configure one or more GitLab package indexes

    For example, in pyproject.toml:

    [[tool.uv.index]]
    name = "myindex"
    url = "https://gitlab.example.com/api/v4/projects/1/packages/pypi/simple"
    authenticate = "always"
    

    Note

    You need authenticate = "always" for uv to invoke keyring when no username is specified. This option is a good idea anyway!

    Alternatively, add the username __token__ to the URL, but this is not recommended for pyproject.toml as you likely want to use a different username in CI, for example.

  5. Done! keyring-gitlab-pypi will return your token for URLs that look like package installs.

Motivation

  • When using multiple GitLab package indexes, it can be cumbersome to configure them with the same token via environment variables or otherwise.
  • keyring's keychain backend on macOS does not support --mode creds
  • uv will reuse credentials for URLs on the same host, but it feels fragile to just configure one of the indexes and let the credentials cache serve the rest. At the very least, keyring-gitlab-pypi is set-and-forget across multiple projects.

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

keyring_gitlab_pypi-0.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

keyring_gitlab_pypi-0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file keyring_gitlab_pypi-0.2.tar.gz.

File metadata

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

File hashes

Hashes for keyring_gitlab_pypi-0.2.tar.gz
Algorithm Hash digest
SHA256 1d3bfbf5735bff5a9db008aa4d0381c5abccbe619c94a6717956b235b4abaea7
MD5 f1a93f18dc4fb0a371f9e911c8877a57
BLAKE2b-256 69aeb77442ea2c52491d4409b47f6fdb2cb259962a076fdb2f8556d757da0d13

See more details on using hashes here.

Provenance

The following attestation bundles were made for keyring_gitlab_pypi-0.2.tar.gz:

Publisher: python-publish.yml on RazerM/keyring-gitlab-pypi

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

File details

Details for the file keyring_gitlab_pypi-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for keyring_gitlab_pypi-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c061a88380607862968f835f3d2edd3b282a08231ac0943495143fc9be7efa
MD5 16deec0d2c253eda454c98b1d6d96d21
BLAKE2b-256 b06267328a75cd823f60ebe4c4721f7bc7f4e0e0f2beaf12cb5b4998b91632d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for keyring_gitlab_pypi-0.2-py3-none-any.whl:

Publisher: python-publish.yml on RazerM/keyring-gitlab-pypi

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