Configure your Python build tool to use the Lightwell Network repository

Configure your Python build tool to resolve dependencies through the Lightwell Network repository by adding the repository to your existing configuration.

Before you begin

About this task

Select the configuration method that matches your build tool. Run the command that corresponds to your chosen repository tier.

Procedure

  • If you are using pip:
    1. Configure authentication by adding your service account credentials to your ~/.netrc file. Create the file if it does not exist:
      machine packages.redhat.com login <service_account_username> password <service_account_token>

      where:

      <service_account_username>: Specifies your registry service account username in the format XXXXXXX|service-account-name

      <service_account_token>: Specifies your registry service account token

    2. Run one of the following commands to set the Lightwell Network repository as your default index:

      To set the Validated repository as your default index:

      $ pip config set global.index-url https://packages.redhat.com/lightwell/python/validated/simple

      To set the Remediated repository as your default index:

      $ pip config set global.index-url https://packages.redhat.com/lightwell/python/remediated/simple

      To set the Predisclosure repository as your default index:

      $ pip config set global.index-url https://packages.redhat.com/lightwell/python/predisclosure/simple 
  • If you are using Pipenv:
    1. Configure authentication by adding your service account credentials to your ~/.netrc file. Create the file if it does not exist:
      machine packages.redhat.com login <service_account_username> password <service_account_token>

      where:

      <service_account_username>: Specifies your registry service account username in the format XXXXXXX|service-account-name

      <service_account_token>: Specifies your registry service account token

    2. Run one of the following commands to install from the Lightwell Network repository:

      To install from the Validated repository:

      $ pipenv install --index https://packages.redhat.com/lightwell/python/validated/simple

      To install from the Remediated repository:

      $ pipenv install --index https://packages.redhat.com/lightwell/python/remediated/simple

      To install from the Predisclosure repository:

      $ pipenv install --index https://packages.redhat.com/lightwell/python/predisclosure/simple
  • If you are using Poetry:
    1. Configure authentication for the Lightwell repository by running the following command:
      $ poetry config http-basic.lightwell "<service_account_username>" "<service_account_token>"

      where:

      <service_account_username>: Specifies your registry service account username in the format XXXXXXX|service-account-name

      <service_account_token>: Specifies your registry service account token

    2. Run one of the following commands to add the Lightwell Network repository as the default source:

      To add the Validated repository:

      $ poetry source add --priority=default lightwell https://packages.redhat.com/lightwell/python/validated

      To add the Remediated repository:

      $ poetry source add --priority=default lightwell https://packages.redhat.com/lightwell/python/remediated

      To add the Predisclosure repository:

      $ poetry source add --priority=default lightwell https://packages.redhat.com/lightwell/python/predisclosure
  • If you are using uv:
    1. Configure authentication by adding your service account credentials to your ~/.netrc file:
      Note
      Create the file if it does not exist. The uv build tool reads credentials from this file.
      machine packages.redhat.com login <service_account_username> password <service_account_token>

      where:

      • <service_account_username>: Specifies your registry service account username in the format XXXXXXX|service-account-name.
      • <service_account_token>: Specifies your registry service account token.
    2. Add one of the following entries to your project's pyproject.toml file to set the Lightwell Network repository as your default index. Setting default = true replaces the Python Package Index (PyPI):
      To set the Validated repository as your default index:
      [[tool.uv.index]]
      name = "lightwell"
      url = "https://packages.redhat.com/lightwell/python/validated/simple"
      default = true
      To set the Remediated repository as your default index:
      [[tool.uv.index]]
      name = "lightwell"
      url = "https://packages.redhat.com/lightwell/python/remediated/simple"
      default = true
      To set the Predisclosure repository as your default index:
      [[tool.uv.index]]
      name = "lightwell"
      url = "https://packages.redhat.com/lightwell/python/predisclosure/simple"
      default = true
      Note
      To set the same default index for every project, add the entry to ~/.config/uv/uv.toml instead of pyproject.toml, and use [[index]] instead of [[tool.uv.index]].
    3. Install the project dependencies:
      • To install all packages at once, run the following command:
        $ uv sync
      • To install one package at a time, run the following command:
        $ uv add <package>
        where:
        • <package>: Specifies the package to install into your Python project.
    4. Optional: To install one package without changing the project configuration, run one of the following commands:
      To install from the Validated repository:
      $ uv pip install --index-url https://packages.redhat.com/lightwell/python/validated/simple <package>
      To install from the Remediated repository:
      $ uv pip install --index-url https://packages.redhat.com/lightwell/python/remediated/simple <package>
      To install from the Predisclosure repository:
      $ uv pip install --index-url https://packages.redhat.com/lightwell/python/predisclosure/simple <package>

What to do next

  1. Create and activate a virtual environment:
    $ python3.12 -m venv venv
    $ source venv/bin/activate
  2. Install a package and confirm that it resolves through the Lightwell Network repository:
    $ pip install numpy
  3. To install a specific version, specify the version number in the install command:
    $ pip install numpy==2.3.5
  4. If you are using the Remediated repository, add a remediated dependency and verify that the resolved package version includes the .rhlw-0000X version suffix. If you are using the Predisclosure repository, add a remediated dependency and verify that the resolved package version includes the .rhlw-0000X-nXXXX version suffix.
    $ pip show numpy | grep Version

    The output should show a version with the .rhlw-0000X or .rhlw-0000X-nXXXX suffix, for example, Version: 2.3.5.rhlw-00001.