Hi :wave: . Just updated to version 2.29 and have ...
# general
a
Hi 👋 . Just updated to version 2.29 and have an issue with
python_distribution
that I wasn't having prior. I'm getting the following error:
Copy code
stderr:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --python-tag not recognized
Simplified taget:
Copy code
python_distribution(
    ...
    wheel_config_settings = {
        "--global-option": [
            "--python-tag",
            "py311",
        ],
    },
)
Any suggestions on what is going on here?
w
Did this work in 2.28?
b
It should have never worked.
--python-tag
is an option to the
bdist_wheel
subcommand and not a global
setup.py
option. Old school:
Copy code
:; touch foo.py
:; pex setuptools -- -c 'from setuptools import setup; setup(name="foo", version="0.1.0")' bdist_wheel --python-tag bar &>/dev/null

:; ls -1 dist/
foo-0.1.0-bar-none-any.whl
~New school:
Copy code
:; echo 'from setuptools import setup; setup(name="foo", version="0.1.0")' > setup.py
:; pex build -c pyproject-build -- --config-setting=--build-option=--python-tag=baz . &>/dev/null

:; ls -1 dist/
foo-0.1.0-bar-none-any.whl
foo-0.1.0-baz-none-any.whl
foo-0.1.0.tar.gz
Always should have been bad:
Copy code
:; pex build -c pyproject-build -- --config-setting=--global-option=--python-tag=baz . 
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools >= 40.8.0
* Getting build dependencies for sdist...
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --python-tag not recognized

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_sdist
This is only supposed to be an example, and not official, but, FWICT, its the only public mention of setuptools support for
--build-option
(and
--global-option
for that matter) besides reading the
setuptools/build_meta.py
source or casting your fortunes to stack overflow, AI slop, etc: https://peps.python.org/pep-0517/#config-settings The fact that setuptools uses keys named like command line flags (with leading
--
, etc) in the config settings dict is hugely confusing of course.
Aha, using
--global-option
for this used to be supported but was deprecated here: https://setuptools.pypa.io/en/stable/history.html#v64-0-0 And killed here: https://setuptools.pypa.io/en/stable/history.html#v69-0-0 So it was this PR that killed you: https://github.com/pantsbuild/pants/pull/21314
🚀 1
So @abundant-tent-27407 that implies you're upgrading from Pants 2.23 or older.
a
Yeah, sorry it was quite a leap 😬
Thanks John for the help, your a legend 🙏