pytest-codspeed icon indicating copy to clipboard operation
pytest-codspeed copied to clipboard

python 3.13 on free-threaded mode doesn't work

Open Vizonex opened this issue 2 months ago • 6 comments

There's a problem one of these dependencies known as cffi that is casuing a massive roadblock for me contributing to a project known as multidict and could possibly be affecting other numerous packages. Here I have a sample of this error from a cibuildwheel from one of my more recent workflows.

    Downloading cffi-2.0.0.tar.gz (523 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [20 lines of output]
        Traceback (most recent call last):
          File "/tmp/tmp.RhgviNFpY1/venv/lib/python3.13t/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
            main()
            ~~~~^^
          File "/tmp/tmp.RhgviNFpY1/venv/lib/python3.13t/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
            json_out["return_val"] = hook(**hook_input["kwargs"])
                                     ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/tmp.RhgviNFpY1/venv/lib/python3.13t/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
            return hook(config_settings)
          File "/tmp/pip-build-env-p6s41oev/overlay/lib/python3.13t/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
            return self._get_build_requires(config_settings, requirements=[])
                   ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmp/pip-build-env-p6s41oev/overlay/lib/python3.13t/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
            self.run_setup()
            ~~~~~~~~~~~~~~^^
          File "/tmp/pip-build-env-p6s41oev/overlay/lib/python3.13t/site-packages/setuptools/build_meta.py", line 317, in run_setup
            exec(code, locals())
            ~~~~^^^^^^^^^^^^^^^^
          File "<string>", line 22, in <module>
        RuntimeError: CFFI does not support the free-threaded build of CPython 3.13. Upgrade to free-threaded 3.14 or newer to use CFFI with the free-threaded build.
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  note: This error originates from a subprocess, and is likely not a problem with pip.
                                                              ✕ 7.31s
Error: cibuildwheel: Command ['pip', 'install', '-r', 'requirements/pytest.txt'] failed with code 1. 
Error: Process completed with exit code 1.

Workarounds

I am willing to try an contribute a small bit of my time to this project by looking into programming in a patch for the 3.13t version or seeing about moving some smaller portions of code on over to Cython if needed so that this can stop affecting numerous supply chains. Otherwise I can always look into contributing to cffi to make another workaround or fix.

Vizonex avatar Oct 03 '25 02:10 Vizonex

That's an issue with cffi. I don't think they'll ever add freethreading support for 3.13, but it's stable starting in 3.14 and definitely supported.

edgarrmondragon avatar Oct 03 '25 02:10 edgarrmondragon

That's an issue with cffi. I don't think they'll ever add freethreading support for 3.13, but it's stable starting in 3.14 and definitely supported.

I'll keep that in mind thanks for the quick response I'll try and come up with a workaround until then.

Vizonex avatar Oct 03 '25 03:10 Vizonex

Thanks for the heads up, we'll definitely work to build an integration without cffi

art049 avatar Oct 24 '25 09:10 art049

@Vizonex I see that pytest_codspeed-4.2.0-py3-none-any.whl and would expect pip install to pick it up as a fallback instead of attempting to build from sdist.

So I imagine the pure-python wheel got picked up but pulled in cffi as a dependency which failed. I scanned through the repository and found out that cffi isn't actually imported anywhere in runtime. It's very likely a mistake to have it among the dependencies and should be removed. It's only used in the build environment.

webknjaz avatar Oct 26 '25 20:10 webknjaz

#93

webknjaz avatar Oct 26 '25 21:10 webknjaz

It's very likely a mistake to have it among the dependencies and should be removed. It's only used in the build environment.

Good catch we used it before we had the prebuilt wheels to build in place but definitely we can wipe it

art049 avatar Oct 26 '25 21:10 art049