Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable package overrides in pip-compile #631

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

charliermarsh
Copy link
Member

Summary

This PR enables overrides to be passed to pip-compile and pip-install via a new --overrides flag.

When overrides are provided, we effectively replace any requirements that are overridden with the overridden versions. This is applied at all depths of the tree.

The merge semantics are such that we replace all requirements of a package with all requirements from the overrides files. So, for example, if a package declares:

foo >= 1.0; python_version < '3.11'
foo < 1.0; python_version >= '3.11'

And the user provides an override like:

foo >= 2.0

Then both of the foo requirements in the package will be replaced with the override.

If instead, the user provided an override like:

foo >= 2.0; python_version < '3.11'
foo < 3.0; python_version >= '3.11'

Then we'd replace both of the original foo requirements with both of these overrides. (In technical terms, for each package in the requirements file, we flat-map over its overrides.)

Closes #511.

@charliermarsh charliermarsh force-pushed the charlie/overrides branch 2 times, most recently from 17e3772 to 77f7290 Compare December 13, 2023 05:34
@charliermarsh charliermarsh enabled auto-merge (squash) December 13, 2023 14:59
@charliermarsh charliermarsh merged commit 69581c0 into main Dec 13, 2023
@charliermarsh charliermarsh deleted the charlie/overrides branch December 13, 2023 15:03
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.

Allow override of dependencies
2 participants