trezor / cython-hidapi

:snake: Python wrapper for the HIDAPI
Other
287 stars 110 forks source link

Incompatible with newly released `Cython==3.0.0` #155

Closed mabrowning closed 1 year ago

mabrowning commented 1 year ago

The Cython project just (2023-07-17) released version 3.0.0 on PyPI, but now hidapi doesn't build:

Building wheels for collected packages: hidapi
...
  Building wheel for hidapi (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9bd73zri/hidapi_60464edcffa44cc0b2caead3f2549a05/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9bd73zri/hidapi_60464edcffa44cc0b2caead3f2549a05/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-dy2scjiu
       cwd: /tmp/pip-install-9bd73zri/hidapi_60464edcffa44cc0b2caead3f2549a05/
  Complete output (9 lines):
  running bdist_wheel
  running build
  running build_ext
  Compiling hid.pyx because it changed.
  [1/1] Cythonizing hid.pyx
  /tmp/pip-install-9bd73zri/hidapi_60464edcffa44cc0b2caead3f2549a05/.eggs/Cython-3.0.0-py3.8-linux-x86_64.egg/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-install-9bd73zri/hidapi_60464edcffa44cc0b2caead3f2549a05/hid.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  building 'hid' extension
  error: unknown file type '.pxd' (from 'chid.pxd')
  ----------------------------------------
  ERROR: Failed building wheel for hidapi

However, by changing https://github.com/trezor/cython-hidapi/blob/master/setup.py#L139 https://github.com/trezor/cython-hidapi/blob/adf89859d79a7da114d0993d0cf7fa0916489a6a/setup.py#L139 to setup_requires=["Cython<3"], it builds sucessfully.

prusnak commented 1 year ago

Fixed in 749da6931f57c4c30596de678125648ccfd6e1cd

bearsh commented 1 year ago

shouldn't this issue kept open until the root cause is fixed?

prusnak commented 1 year ago

shouldn't this issue kept open until the root cause is fixed?

Compatibility with Cython 3.x is another issue - https://github.com/trezor/cython-hidapi/issues/156

Any help welcome!