etiennedub / pyk4a

Python 3 wrapper for Azure-Kinect-Sensor-SDK
MIT License
290 stars 81 forks source link

sdist build fails with modern setuptools #194

Closed jsirois closed 1 year ago

jsirois commented 1 year ago

Looks like so:

jsirois@Gill-Windows:/tmp/Zdenek $ curl -fLO https://files.pythonhosted.org/packages/56/97/1f1d0fb4c18809d9c310bbd5108f0ff6284bb7e4dd56a6155b2f98816751/pyk4a-1.4.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 23267  100 23267    0     0  48173      0 --:--:-- --:--:-- --:--:-- 48271
jsirois@Gill-Windows:/tmp/Zdenek $ python3.10 -mvenv test.venv
jsirois@Gill-Windows:/tmp/Zdenek $ test.venv/bin/pip wheel --no-deps pyk4a-1.4.0.tar.gz
Processing ./pyk4a-1.4.0.tar.gz
  File was already downloaded /tmp/Zdenek/pyk4a-1.4.0.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      /tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/dist.py:775: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
        warnings.warn(
      Automatic kinect SDK detection did not yield any results.
      Traceback (most recent call last):
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 35, in __init__
          parsed = parse_requirement(requirement_string)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/_parser.py", line 64, in parse_requirement
          return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/_parser.py", line 82, in _parse_requirement
          url, specifier, marker = _parse_requirement_details(tokenizer)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/_parser.py", line 126, in _parse_requirement_details
          marker = _parse_requirement_marker(
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/_parser.py", line 147, in _parse_requirement_marker
          tokenizer.raise_syntax_error(
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/_tokenizer.py", line 163, in raise_syntax_error
          raise ParserSyntaxError(
      pkg_resources.extern.packaging._tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier)
          python_version >= "3.4"
                         ^

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "/tmp/Zdenek/test.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/tmp/Zdenek/test.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/tmp/Zdenek/test.venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 484, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 72, in <module>
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          _install_setup_requires(attrs)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 78, in _install_setup_requires
          dist.parse_config_files(ignore_option_errors=True)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 874, in parse_config_files
          self._finalize_requires()
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 581, in _finalize_requires
          self._move_install_requirements_markers()
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 621, in _move_install_requirements_markers
          inst_reqs = list(_reqs.parse(spec_inst_reqs))
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3095, in __init__
          super(Requirement, self).__init__(requirement_string)
        File "/tmp/pip-build-env-cydpuw7o/overlay/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 37, in __init__
          raise InvalidRequirement(str(e)) from e
      pkg_resources.extern.packaging.requirements.InvalidRequirement: Expected end or semicolon (after name and no valid version specifier)
          python_version >= "3.4"
                         ^
      [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.

The issue here is the python_requires line in setup.cfg: https://github.com/etiennedub/pyk4a/blob/2791f6ea6678f889e3d6a730eb924fd7cd4a95ee/setup.cfg#L17-L21

The immediate issue is the quoting around the version specifier, it should just be:

[options] 
 packages = pyk4a 
 install_requires = 
     numpy 
     python_version >= 3.4

The secondary issue is that the python_requires metadata should not be included as a python_version psuedo-project in install_requires but as its own metadata line. See the table here as well as examples higher up the page: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#options

lpasselin commented 1 year ago

Fixed with version 1.5.0. Thanks!