Chainguard Libraries for Python overview
Learn about Chainguard Libraries for Python, providing enhanced security for PyPI packages through automated …
For the complete documentation index, see llms.txt.
Python library consumption in a large organization is typically managed by a repository manager. Commonly used repository manager applications are Cloudsmith, JFrog Artifactory, and Sonatype Nexus Repository. The repository manager acts as a single point of access for developers and development tools to retrieve the required libraries.
At a high level, adopting the use of Chainguard Libraries consists of the following steps:
You should also:
If your organization does not use a repository manager, you can still use Chainguard Libraries. However, this approach requires configuration of multiple build and development platforms and utilities to use Chainguard Libraries. For this reason, adopting the use of a repository manager is the recommended approach. Refer to the direct access documentation for build tools for more information.
Before configuring your repo manager, consider how you want to handle packages that aren’t yet available in the Chainguard Libraries repository. If you configure a fallback to PyPI, packages sourced from that registry are not covered by Chainguard’s malware-resistance guarantees. See the fallback approaches described in the Chainguard Libraries quick start for guidance on choosing the right approach for your environment.
Cloudsmith supports Python repositories for proxying and hosting and polyglot repositories that combine multiple repositories sources with compatible formats. Refer to the Cloudsmith Python Repository documentation and the Cloudsmith documentation for creating a repository for more information.
Use the following steps to add a repository with both Chainguard Libraries for Python and PyPI as upstream sources.
First, create a repository:
Next, configure the upstream proxies:
python-chainguard1https://libraries.cgr.dev/python/Cache and Proxypython-chainguard-remediated,
the priority 2, the same authentication details, and the URL
https://libraries.cgr.dev/python-remediated/.python-public3https://pypi.org/Cache and ProxySee the page on build tool configuration for Chainguard Libraries for Python for information on accessing credentials and setting up build tools.
Google Artifact Registry supports
the Python format for hosting artifacts in Standard repositories and proxying
artifacts from public repositories in Remote repositories. Use Virtual
repositories to combine them for consumption with pip and other build tools.
Use the Python package documentation for Google Artifact
Registry as the starting
point for more details.
Use the following steps to add the Pypi Package Index and the Chainguard Libraries for Python repository as remote repositories and combine them as a virtual repository:
Before configuring the repositories, you must create a secret with the password value as retrieved with chainctl:
Navigate to Artifact Registry and select Repositories in the left hand navigation under the Artifact Registry label to configure a remote repository for the Pypi Package Index:
Configure a remote repository for the Chainguard Libraries for Python repository:
Combine the two repositories in a new virtual repository:
JFrog Artifactory supports PyPI repositories for proxying and virtual repositories to combine multiple sources into a single repository. The following instructions are based on the PyPI Repository documentation for Artifactory.
Use the following steps to add the Chainguard Libraries for Python index and the PyPI public index as remote repositories and combine them as a virtual repository:
Configure a remote repository for the Chainguard Libraries for Python index:
python-chainguard.https://libraries.cgr.dev/python/.https://libraries.cgr.dev/python/.If you want to use the separate repository with remediated Python
libraries repeat the
preceding steps with the name python-chainguard-remediated, the same
authentication details, and the URL
https://libraries.cgr.dev/python-remediated/.
Configure a remote repository for the PyPI public index:
python-public.https://files.pythonhosted.org.https://pypi.org/.Combine the two repositories in a new virtual repository:
python-all.python-chainguard and
python-public repositories. Ensure the python-chainguard repository is
the first in the displayed list. Use the icon on the right of the repository
name to drag and drop repositories into the desired position.At this point, you have a virtual repository set up in Artifactory that allows you or others in your organization to access Chainguard Libraries for Python, optionally including remediated versions, with your chosen tools. This setup falls back to the public PyPI index in cases where a package is not available in Chainguard’s index.
See the page on build tool configuration for Chainguard Libraries for Python for information on accessing credentials and setting up build tools.
Sonatype Nexus Repository allows for merging multiple remote repositories as a repository group. The below instructions are based on the Nexus documentation for PyPI
The following steps create remote repositories for Chainguard Libraries for Python, a remote repository for the public PyPI index, and a repository group combining these sources.
First, log in to Sonatype Nexus as a user with administrator privileges and access the Server administration and configuration section within the gear icon in the top navigation bar.
Next, configure a remote repository for the public PyPI index:
python-public.https://pypi.org/.Configure a remote repository for the Chainguard Libraries for Python repository:
python-chainguard.https://libraries.cgr.dev/python/.If you want to use the separate repository with remediated Python
libraries repeat the
preceding steps with the name python-chainguard-remediated, the same
authentication details, and the URL
https://libraries.cgr.dev/python-remediated/.
Finally, create a new repository group and add the two repositories:
python-all.python-public and python-chainguard to the right and move the
python-chainguard repository to the top of the list with the arrow control.
If you configured the python-chainguard-remediated repository, also move
it to the right and the top of the list.See the page on build tool configuration for Chainguard Libraries for Python for information on accessing credentials and setting up build tools.
Last updated: 2025-04-07 14:42