Skip to content

feat(pypi): change the dependencies and tags of a package with pip.override - #8

Draft
aignas wants to merge 2 commits into
feat.aignas.pycross-parity-05-override-packagefrom
feat.aignas.pycross-parity-06-override-deps
Draft

aignas wants to merge 2 commits into
feat.aignas.pycross-parity-05-override-packagefrom
feat.aignas.pycross-parity-06-override-deps

Conversation

@aignas

@aignas aignas commented Nov 19, 2026

Copy link
Copy Markdown
Owner

The dependencies of a package come from its wheel METADATA and cannot be
changed without patching the wheel, e.g. to drop a dependency that is only
needed for optional features, to break a dependency cycle or to add a missing
dependency. rules_pycross has ignore_dependencies, extra_dependencies and
wheel_library_tags for this.

This adds ignore_dependencies (package names), extra_dependencies (PEP 508
requirements, markers allowed) and tags to pip.override(package = ...).
They are passed to the whl repositories as attributes that only change the
generated BUILD.bazel file: the Requires-Dist lines of the ignored packages
are removed (including the ones for extras) and the extra lines are added, so
they get the same select()s and filtering as the METADATA dependencies.
The names have to be in the targeted hubs. The settings for a hub are added to
the settings for all hubs.

The patch docs page is renamed to override with a redirect.

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

…erride

The dependencies of a package come from its METADATA and cannot be changed
without patching the wheel, e.g. to drop a dependency that is only needed for
optional features or to add a missing one. Add 'ignore_dependencies',
'extra_dependencies' (PEP 508 requirements with markers) and 'tags' to
pip.override(package = ...). They are passed to the whl repositories as
attributes that only change the generated BUILD file, so they do not prevent
sharing the extracted wheels.
…ings

Only accept package names in ignore_dependencies, so that e.g. 'bar[x]' does
not silently ignore nothing, and add the settings for a hub to the settings
for all hubs, like the patches.
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