pip
pip copied to clipboard
Deprecate --install-options
--install-options
forces pip to use setuptools
's install
command which is deprecated.
So we need to deprecate this pip option.
Towards #8102
@sbidoul is it the same as https://github.com/pypa/pip/issues/10265 ?
@sbidoul is it the same as https://github.com/pypa/pip/issues/10265 ?
No. #10265 is purely a documentation issue.
Some discussion here. Title: Passing command line arguments to pip install after --install-options deprecation
If I understand conclusion of talk linked above, we can't use --config-settings as replacement of --install-option for pip install. So warning message is misleading.
@AlexanderSerov It might be more accurate to expand the sentence to be
A possible replacement is to use --config-settings
to pass options to the wheel building process
@sbidoul What still give me a little clues as dev how just migrating packaging process from setuptools to pip. I use --install-options previosly and it's no more work in pip, so warning should be extended with more information from this message at least. I am not python dev though, so can give you a little help how it should be formulated exactly.
For those wondering how to use --config-setting
to pass a flag, try --config-setting="--build-option=--your_flag"
, then --your_flag
is available in setup.py
in sys.argv
.
I use this for explicit optional cythonization, more details here. I'm not sure this is the correct way to use this option (this form of build_option won't be deprecated?), it would be great to get some clarification on the matter.
/EDIT: if --config-setting
does not work, try --config-settings
(plural) (thanks to @cacti77 below!).
Also, if your goal is to pass a build option, then you may need to also pass --no-binary "mypkg" --no-cache
to force the use of sdists instead of wheels, as otherwise your package won't get built with pip install
if wheels are available for your platform and Python version (this is unnecessary with build
).
/EDIT2: if you use build
too, then only the singular form --config-setting
is supported, not the plural form! But pip
supports both forms so that's why I got the habit of always using the singular form. This may change in the future since pip
exposes the plural form as the default one.
I'm not sure this is the correct way to use this option (this form of build_option won't be deprecated?),
Actually, this would be a question for the setuptools project. The config settings mechanism of passing key/value options to the build backend is standardized, but the actual keys and values are build backend dependent.
@sbidoul Thank you very much, this actually answers half of my question, because since the key/value options handling is managed by the backend (pip only handling the communication/creation of this key/value store from commandline arguments), then it means this option will at least not get deprecated with pip 23.3 :-) I will see with setuptools what their plans are about it, thank you!
For those wondering how to use
--config-setting
to pass a flag, try--config-setting="--build-option=--your_flag"
, then--your_flag
is available insetup.py
insys.argv
.I use this for explicit optional cythonization, more details here. I'm not sure this is the correct way to use this option (this form of build_option won't be deprecated?), it would be great to get some clarification on the matter.
Thanks @Irq3000! Actually, I think it should be --config-settings
, not --config-setting
, in case others missed that like I did:(.
@cacti77 Ah thank you for pointing this out, indeed in pip install --help
only the plural form is shown, I guess that the singular form is an alias (but for me it still works with the latest pip 23.1). I edited my answer above with your suggestions, thank you!
/EDIT: Ah I know why I chose the singular form, it's because this is the only one supported by the build
tool, so I assumed that it was the same for pip
. I have opened an issue to suggest to standardize using either the plural or singular form: https://github.com/pypa/build/issues/608