Configure your Python build tool to resolve dependencies through the Red Hat Lightwell Network repository by adding the repository to your existing configuration.
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:
- 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
- Run one of the following commands to set the Red Hat 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/network/python/validated
To set the Remediated repository as your default index:
$ pip config set global.index-url https://packages.redhat.com/lightwell/network/python/remediated
- If you are using Pipenv:
- 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
- Run one of the following commands to install from the Red Hat Lightwell Network repository:
To install from the Validated repository:
$ pipenv install --index https://packages.redhat.com/lightwell/network/python/validated
To install from the Remediated repository:
$ pipenv install --index https://packages.redhat.com/lightwell/network/python/remediated
- If you are using Poetry:
- 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
- Run one of the following commands to add the Red Hat Lightwell Network repository as the default source:
To add the Validated repository:
$ poetry source add --priority=default lightwell https://packages.redhat.com/lightwell/network/python/validated
To add the Remediated repository:
$ poetry source add --priority=default lightwell https://packages.redhat.com/lightwell/network/python/remediated
What to do next
- Create and activate a virtual environment:
$ python3.12 -m venv venv
$ source venv/bin/activate
- Install a package and confirm that it resolves through the Red Hat Lightwell Network repository:
- To install a specific version, specify the version number in the install command:
$ pip install numpy==2.3.5
- If you are using the Remediated repository, add a remediated dependency and verify that the resolved package version includes the
.rhlw-0000X version suffix.
$ pip show numpy | grep Version
The output should show a version with the .rhlw-0000X suffix, for example, Version: 2.3.5.rhlw-00001.