Skip to content

feat(pypi): read the pylock.toml lock files - #11

Draft
aignas wants to merge 2 commits into
feat.aignas.pycross-parity-08-build-modefrom
feat.aignas.pycross-parity-09-pylock
Draft

aignas wants to merge 2 commits into
feat.aignas.pycross-parity-08-build-modefrom
feat.aignas.pycross-parity-09-pylock

Conversation

@aignas

@aignas aignas commented Nov 19, 2026

Copy link
Copy Markdown
Owner

pylock.toml (PEP 751) is the standard lock file format that uv, pdm,
pip lock and poetry-plugin-export can write, but pip.parse only reads
requirements.txt files and uv.lock. rules_pycross reads it, and it is the
way to consume pdm.lock and poetry.lock files.

This adds pip.parse(pylock = ...), which translates the lock file into the
lock model that the uv.lock support uses:

  • All of the extras, default-groups and dependency-groups are selected,
    so that the hub has all of the packages; pip.configure limits which of
    them are exposed.
  • A package is used on the platforms where its marker is true; the
    dependency graph is not used, as the standard requires. Its
    requires-python has to match those platforms.
  • The top-level requires-python has to match the platforms; the platforms
    that do not match the environments are ignored with a warning.
  • index becomes the index URL of the package, the strongest of the
    hashes is used and local_wheels work like with uv.lock.

The vcs, archive and directory sources fail for now and are left for a
follow-up. pep508_evaluate support for the extras and dependency_groups
markers comes from #4.

Work towards bazel-contrib#2787.

Stack (fork test PRs): on top of #10.

Add pip.parse(pylock = ...), which reads a pylock.toml (PEP 751) file into the
lock model. All of the listed extras and dependency groups are selected and a
package is used on the platforms where its marker and requires-python are
true, the dependency graph is not used as the standard requires. The
top-level requires-python has to match the platforms and the platforms that
do not match the environments are ignored. The vcs, archive and directory
sources are left for later.

Work towards bazel-contrib#2787.
Also only use the platforms that match the lock file when exposing the
packages, fail for a package whose requires-python does not match a platform
where it is needed, without a version or when the pylock is used with the
other lock files and warn about the files without a URL.
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