Bug 2325203

Summary: python-pyproject-api fails to build with Python 3.14: BackendFailed + AssertionError in tests
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-pyproject-apiAssignee: Lumír Balhar <lbalhar>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, lbalhar, mhroncok, python-packagers-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-14 11:06:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2024-11-11 14:47:51 UTC
python-pyproject-api fails to build with Python 3.14.0a1.

=================================== FAILURES ===================================
_________________ test_setuptools_get_requires_for_build_wheel _________________

frontend_setuptools = <pyproject_api._via_fresh_subprocess.SubprocessFrontend object at 0x7eff3e7ae4e0>

    def test_setuptools_get_requires_for_build_wheel(frontend_setuptools: SubprocessFrontend) -> None:
        result = frontend_setuptools.get_requires_for_build_wheel()
>       assert not result.requires
E       assert not (<Requirement('wheel')>,)
E        +  where (<Requirement('wheel')>,) = RequiresBuildWheelResult(requires=(<Requirement('wheel')>,), out="started backend BackendProxy(backend=<module 'setupt...t'\nBackend: Wrote response {'return': ['wheel']} to /tmp/pep517_get_requires_for_build_wheel-oijnozbs.json\n", err='').requires

tests/test_frontend_setuptools.py:61: AssertionError
_________________________ test_setuptools_build_wheel __________________________

frontend_setuptools = <pyproject_api._via_fresh_subprocess.SubprocessFrontend object at 0x7eff3e7ae4e0>
tmp_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_setuptools_build_wheel0')

    def test_setuptools_build_wheel(frontend_setuptools: SubprocessFrontend, tmp_path: Path) -> None:
>       result = frontend_setuptools.build_wheel(tmp_path)

tests/test_frontend_setuptools.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib/python3.14/site-packages/pyproject_api/_frontend.py:408: in build_wheel
    basename, out, err = self._send(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pyproject_api._via_fresh_subprocess.SubprocessFrontend object at 0x7eff3e7ae4e0>
cmd = 'build_wheel'
kwargs = {'config_settings': None, 'metadata_directory': None, 'wheel_directory': PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_setuptools_build_wheel0')}
result_file_marker = <tempfile._TemporaryFileWrapper object at 0x7eff3e8485f0>
result_file = PosixPath('/tmp/pep517_build_wheel-5ipdevzo.json')
msg = '{"cmd": "build_wheel", "kwargs": {"wheel_directory": "/tmp/pytest-of-mockbuild/pytest-0/test_setuptools_build_wheel0", "config_settings": null, "metadata_directory": null}, "result": "/tmp/pep517_build_wheel-5ipdevzo.json"}'
status = <SubprocessCmdStatus(Thread-41, stopped 139634710681280)>
result_handler = <_io.TextIOWrapper name='/tmp/pep517_build_wheel-5ipdevzo.json' mode='rt' encoding='UTF-8'>

    def _send(self, cmd: str, **kwargs: Any) -> tuple[Any, str, str]:
        with NamedTemporaryFile(prefix=f"pep517_{cmd}-") as result_file_marker:
            result_file = Path(result_file_marker.name).with_suffix(".json")
            msg = json.dumps(
                {
                    "cmd": cmd,
                    "kwargs": {k: (str(v) if isinstance(v, Path) else v) for k, v in kwargs.items()},
                    "result": str(result_file),
                },
            )
            with self._send_msg(cmd, result_file, msg) as status:
                while not status.done:  # pragma: no branch
                    sleep(0.001)  # wait a bit for things to happen
            if result_file.exists():
                try:
                    with result_file.open("rt") as result_handler:
                        result = json.load(result_handler)
                finally:
                    result_file.unlink()
            else:
                result = {
                    "code": 1,
                    "exc_type": "RuntimeError",
                    "exc_msg": f"Backend response file {result_file} is missing",
                }
        out, err = status.out_err()
        if "return" in result:
            return result["return"], out, err
>       raise BackendFailed(result, out, err)
E       pyproject_api._frontend.BackendFailed: packaging backend failed (code=usage: _backend.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
E          or: _backend.py --help [cmd1 cmd2 ...]
E          or: _backend.py --help-commands
E          or: _backend.py cmd --help
E       
E       error: invalid command 'bdist_wheel'), with SystemExit: usage: _backend.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
E          or: _backend.py --help [cmd1 cmd2 ...]
E          or: _backend.py --help-commands
E          or: _backend.py cmd --help
E       
E       error: invalid command 'bdist_wheel'
E       Traceback (most recent call last):
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 534, in _parse_command_opts
E           cmd_class = self.get_command_class(command)
E         File "/usr/lib/python3.14/site-packages/setuptools/dist.py", line 717, in get_command_class
E           return _Distribution.get_command_class(self, command)
E                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 844, in get_command_class
E           raise DistutilsModuleError("invalid command '%s'" % command)
E       distutils.errors.DistutilsModuleError: invalid command 'bdist_wheel'
E       
E       During handling of the above exception, another exception occurred:
E       
E       Traceback (most recent call last):
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 172, in setup
E           ok = dist.parse_command_line()
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 475, in parse_command_line
E           args = self._parse_command_opts(parser, args)
E         File "/usr/lib/python3.14/site-packages/setuptools/dist.py", line 869, in _parse_command_opts
E           nargs = _Distribution._parse_command_opts(self, parser, args)
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/dist.py", line 536, in _parse_command_opts
E           raise DistutilsArgError(msg)
E       distutils.errors.DistutilsArgError: invalid command 'bdist_wheel'
E       
E       During handling of the above exception, another exception occurred:
E       
E       Traceback (most recent call last):
E         File "/builddir/build/BUILD/python-pyproject-api-1.8.0-build/BUILDROOT/usr/lib/python3.14/site-packages/pyproject_api/_backend.py", line 93, in run
E           outcome = backend_proxy(parsed_message["cmd"], **parsed_message["kwargs"])
E         File "/builddir/build/BUILD/python-pyproject-api-1.8.0-build/BUILDROOT/usr/lib/python3.14/site-packages/pyproject_api/_backend.py", line 34, in __call__
E           return getattr(on_object, name)(*args, **kwargs)
E                  ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
E         File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 410, in build_wheel
E           return self._build_with_temp_dir(
E                  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E               ['bdist_wheel'],
E               ^^^^^^^^^^^^^^^^
E           ...<3 lines>...
E               self._arbitrary_args(config_settings),
E               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           )
E           ^
E         File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
E           self.run_setup()
E           ~~~~~~~~~~~~~~^^
E         File "/usr/lib/python3.14/site-packages/setuptools/build_meta.py", line 311, in run_setup
E           exec(code, locals())
E           ~~~~^^^^^^^^^^^^^^^^
E         File "<string>", line 1, in <module>
E         File "/usr/lib/python3.14/site-packages/setuptools/__init__.py", line 104, in setup
E           return distutils.core.setup(**attrs)
E                  ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
E         File "/usr/lib/python3.14/site-packages/setuptools/_distutils/core.py", line 174, in setup
E           raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
E       SystemExit: usage: _backend.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
E          or: _backend.py --help [cmd1 cmd2 ...]
E          or: _backend.py --help-commands
E          or: _backend.py cmd --help
E       
E       error: invalid command 'bdist_wheel'
E       started backend BackendProxy(backend=<module 'setuptools.build_meta' from '/usr/lib/python3.14/site-packages/setuptools/build_meta.py'>)
E       Backend: run command build_wheel with args {'wheel_directory': '/tmp/pytest-of-mockbuild/pytest-0/test_setuptools_build_wheel0', 'config_settings': None, 'metadata_directory': None}
E       Backend: Wrote response {'code': "usage: _backend.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]\n   or: _backend.py --help [cmd1 cmd2 ...]\n   or: _backend.py --help-commands\n   or: _backend.py cmd --help\n\nerror: invalid command 'bdist_wheel'", 'exc_type': 'SystemExit', 'exc_msg': "usage: _backend.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]\n   or: _backend.py --help [cmd1 cmd2 ...]\n   or: _backend.py --help-commands\n   or: _backend.py cmd --help\n\nerror: invalid command 'bdist_wheel'"} to /tmp/pep517_build_wheel-5ipdevzo.json

../BUILDROOT/usr/lib/python3.14/site-packages/pyproject_api/_frontend.py:522: BackendFailed
=========================== short test summary info ============================
FAILED tests/test_frontend_setuptools.py::test_setuptools_get_requires_for_build_wheel
FAILED tests/test_frontend_setuptools.py::test_setuptools_build_wheel - pypro...
================== 2 failed, 56 passed, 1 deselected in 3.28s ==================

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08241163-python-pyproject-api/

For all our attempts to build python-pyproject-api with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/python-pyproject-api/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Lumír Balhar 2024-11-12 14:30:22 UTC
This should be fixed when we build new setuptools and wheel in the COPR.

Comment 2 Lumír Balhar 2024-11-14 11:06:54 UTC
It builds fine now with new setuptools.