Skip to content

feat(pypi): patch all of the wheels of a package with pip.override - #7

Draft
aignas wants to merge 2 commits into
feat.aignas.pycross-parity-04-uv-conflictsfrom
feat.aignas.pycross-parity-05-override-package
Draft

aignas wants to merge 2 commits into
feat.aignas.pycross-parity-04-uv-conflictsfrom
feat.aignas.pycross-parity-05-override-package

Conversation

@aignas

@aignas aignas commented Nov 19, 2026

Copy link
Copy Markdown
Owner

pip.override can only patch a single wheel file. Patching a package needs
one override per platform and Python version, and the wheels that are built
from an sdist cannot be patched at all because their file names are not known
when the module extension runs. rules_pycross users have a single
post_install_patches per package.

This adds pip.override(package = "foo") (optionally foo@1.2.3), which
patches every wheel of the package, including the wheels built from an sdist,
and hub_name to limit it to one hub. The versions are compared with the
PEP 440 == semantics. A package override that matches no package in the
targeted hubs fails. file overrides behave as before and pass the same args
to the whl repositories. The parsing of the tags moves to whl_overrides.bzl
so that it can be unit tested.

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

The pip.override tag class can only patch a single wheel file, so patching a
package needs one override per platform and cannot patch the wheels that are
built from an sdist. Add the 'package' attribute, optionally with a version
('foo@1.2.3'), to patch all of the wheels of a package and the 'hub_name'
attribute to limit it to one hub. The parsing moves to whl_overrides.bzl.
Also look up the overrides by the declared hub name so that they keep working
for the reserved 'pypi' hub, validate the package value and keep the encoded
args minimal.
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