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

support per-requirement options #2000

Open
belm0 opened this issue Oct 11, 2023 · 4 comments
Open

support per-requirement options #2000

belm0 opened this issue Oct 11, 2023 · 4 comments

Comments

@belm0
Copy link

belm0 commented Oct 11, 2023

What's the problem this feature will solve?

pip supports per-requirement options, e.g. --config-settings

I'm forced to use per-requirement --config-settings, because there are cases where pip intentionally does not honor the command-line --config-settings.

Configuration settings provided via --config-settings command line options (or the equivalent environment variables or configuration file entries) are passed to the build of requirements explicitly provided as pip command line arguments. They are not passed to the build of dependencies, or to the build of requirements provided in requirement files.

But pip-compile does not seem to propagate per-requirement options.

Describe the solution you'd like

I'd like pip-compile to propagate per-requirement options from .in to .txt

$ echo 'scipy==1.10.1; --config-settings="setup-args=-Dblas=blas"' > r.in

$ pip-compile -r r.in
numpy==1.24.4
    # via scipy
scipy==1.10.1; --config-settings="setup-args=-Dblas=blas"
    # via -r r2.in

Alternative Solutions

Command line pip --config-settings doesn't work, because I'm passing a requirements file to pip wheel, and pip intentionally doesn't propagate the settings.

My current workaround is to build the affected packages separately, avoiding use of a requirements file. But it's not good for my use case, which is to build all the transitive dependencies for an application (targeting an alternative python implementation). pip wheel -r ... is best suited for this.

@webknjaz
Copy link
Member

Pip doesn't put them into comments like that, though. Said section is reserved for the environment markers.

@webknjaz
Copy link
Member

Also, it appears you confuse the function of constraint files compared to the incoming requirements. Constraints probably don't need this.

@AndydeCleyre
Copy link
Contributor

Just to add to workaround thoughts (not sure if I'm using the option syntax right, but this is what I understand from the docs):

r.in:

scipy==1.10.1
$ pip-compile r.in

configured.txt:

-r r.txt
--config-settings="setup-args=-Dblas=blas" scipy
$ pip install -r configured.txt

Would that work?

@NickDarvey
Copy link

Just to add to workaround thoughts

That works for me, thanks @AndydeCleyre

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

No branches or pull requests

4 participants