Skip to content

feat: Add support for Python package ecosystem#2164

Draft
EyeCantCU wants to merge 5 commits intochainguard-dev:mainfrom
EyeCantCU:libraries
Draft

feat: Add support for Python package ecosystem#2164
EyeCantCU wants to merge 5 commits intochainguard-dev:mainfrom
EyeCantCU:libraries

Conversation

@EyeCantCU
Copy link
Copy Markdown
Member

And standardize introduction of other ecosystems

EyeCantCU and others added 5 commits April 3, 2026 13:45
Add a declarative ecosystem package system that allows installing
packages from non-APK ecosystems (starting with Python/PyPI) directly
into OCI images without shelling out to pip or any other tool.

Packages are resolved via the PEP 503 Simple Repository API, downloaded
as wheels, and extracted directly into the filesystem. The new
`ecosystems.python` config block supports custom indexes, version
constraints, and auto-detection of the installed Python version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use the PyPI JSON API (pypi.org/pypi/{name}/{version}/json) to resolve
packages and discover transitive dependencies, instead of downloading
entire wheels just to read their METADATA files. The JSON API returns
clean requires_dist lists and wheel URLs with checksums in a single
request.

Falls back to the PEP 503 Simple API for non-PyPI indexes (private
registries), though without transitive resolution in that case.

Also adds environment marker evaluation (extra, os_name, sys_platform,
etc.) to correctly filter conditional dependencies, and pre-release
filtering to avoid resolving alpha/beta/rc versions unless pinned.

Tested with torch==2.6.0 which correctly resolves all 24 transitive
dependencies automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename the package directory and Go package from "pip" to "python" to
match the ecosystem name used in YAML config. Update all import paths
and log messages accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove readMetadata and parseRequiresDist, which are no longer used
after switching to the PyPI JSON API for dependency discovery.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When `venv` is set in the python ecosystem config, packages are
installed into a virtual environment with proper pyvenv.cfg and
bin/python symlinks. The image environment is automatically configured
with VIRTUAL_ENV and PATH prepended with the venv bin directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant