Configure uv for the trusted index

Set up the uv package manager to use the Red Hat Trusted Libraries index for Python dependencies.

About this task

Configure the uv package manager to fetch Python dependencies from the Red Hat Trusted Libraries index. This requires updating your project configuration.

Prerequisites

  • You have installed uv.
  • You have a valid Red Hat Service Account token.
  • Your project uses Python 3.12.12.

Procedure

  1. In your project root, add the trusted index to your pyproject.toml file:
    [[tool.uv.index]]
    name = "trusted-libraries"
    url = "https://packages.redhat.com/trusted-libraries/python"
    default = true
    Note

    Setting default = true ensures that uv prioritizes the trusted index over the public PyPI registry.

  2. Authenticate your session by exporting your Service Account credentials as environment variables:
    export UV_INDEX_INTERNAL_PROXY_USERNAME=<username>
    export UV_INDEX_INTERNAL_PROXY_PASSWORD=<password>

    where:

    <username>
    Specifies your Registry Service Account username.
    <password>
    Specifies your generated authentication token.
  3. (Optional) To persist these credentials across sessions, add the export commands to your shell configuration file (for example, .bashrc or .zshrc).
  4. Verify the configuration by adding a package to your project:
    uv add <package_name>

    where:

    <package_name>
    Specifies the name of the Python package you want to install from the trusted index (for example, numpy).