pip icon indicating copy to clipboard operation
pip copied to clipboard

Deprecate --install-options

Open sbidoul opened this issue 2 years ago • 2 comments

--install-options forces pip to use setuptools's install command which is deprecated.

So we need to deprecate this pip option.

Towards #8102

sbidoul avatar Aug 07 '22 16:08 sbidoul

@sbidoul is it the same as https://github.com/pypa/pip/issues/10265 ?

Patelrahul4884 avatar Aug 16 '22 11:08 Patelrahul4884

@sbidoul is it the same as https://github.com/pypa/pip/issues/10265 ?

No. #10265 is purely a documentation issue.

sbidoul avatar Aug 18 '22 16:08 sbidoul

Some discussion here. Title: Passing command line arguments to pip install after --install-options deprecation

AlexanderSerov avatar Jan 20 '23 14:01 AlexanderSerov

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. image

AlexanderSerov avatar Jan 23 '23 07:01 AlexanderSerov

@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 avatar Jan 23 '23 08:01 sbidoul

@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.

AlexanderSerov avatar Jan 23 '23 10:01 AlexanderSerov

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.

lrq3000 avatar Apr 02 '23 02:04 lrq3000

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 avatar Apr 02 '23 09:04 sbidoul

@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!

lrq3000 avatar Apr 02 '23 21:04 lrq3000

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.

Thanks @Irq3000! Actually, I think it should be --config-settings, not --config-setting, in case others missed that like I did:(.

cacti77 avatar Apr 26 '23 15:04 cacti77

@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

lrq3000 avatar Apr 26 '23 20:04 lrq3000