Setuptools does not pass config_settings through backend
See original GitHub issueThe build
project now has a --config-setting
flag to pass options to the backend:
$ python -m build --help
usage: python -m build [-h] [--version] [--sdist] [--wheel] [--outdir dir] [--skip-dependencies]
[--no-isolation] [--config-setting CONFIG_SETTING]
[srcdir]
- - - >8 - - -
--config-setting CONFIG_SETTING, -C CONFIG_SETTING
pass option to the backend
I wanted to use this to set wheel
’s --plat-name
argument like so:
$ python -m build --wheel --config-setting plat-name=foo
I found that this worked as expected until the settings got to setuptool’s _build_with_temp_dir
function:
In this example, _build_with_temp_dir
gets called with config_settings={'plat-name': 'foo'}
, which then gets ‘fixed’ into config_settings={'plat-name': 'foo', '--global-option': []}
, and then setuptools ignores everything in config_settings
and only considers --global-option
.
It almost seems like --global-option
itself could be used for this, but unfortunately it doesn’t work as it’s value is passed to lots of things that don’t accept the arguments I’m hoping to pass:
$ python -m build --wheel --config-setting="--global-option=--plat-name" --config-setting="--global-option=foo" -n
usage: _in_process.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: _in_process.py --help [cmd1 cmd2 ...]
or: _in_process.py --help-commands
or: _in_process.py cmd --help
error: option --plat-name not recognized
...
I created a commit that “fixes” this for me as a proof of concept: https://github.com/pypa/setuptools/commit/fc95b3b83d6d5b561dc0a356995edf4c99785a6f
Possibly related issues:
- this is very similar to the request in https://github.com/pypa/setuptools/issues/1816, but @gaborbernat is asking for the ability to pass options before the setup command, rather than after.
- https://github.com/pypa/setuptools/issues/1928 may also be related
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:22 (12 by maintainers)
Top GitHub Comments
FYI I am also in favor of removing the dashes, I don’t think they are needed in PEP 517.
I commented on this upthread:
This is all setuptools-specific stuff, the spec has no notion of global options nor does it expect that options will be passed to a CLI.