python-cmake / pytest-cmake

Pytest module for CMake
https://python-cmake.github.io/pytest-cmake/
MIT License
25 stars 0 forks source link

Installation error with Hatchling v1.22 #21

Closed buddly27 closed 6 months ago

buddly27 commented 6 months ago

The latest update of Hatchling causes the following installation error:

Processing /home/runner/work/pytest-cmake/pytest-cmake
  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
  ╰─> [32 lines of output]
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 1[18](https://github.com/buddly27/pytest-cmake/actions/runs/8317355309/job/22758020884#step:7:19), in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-bb2wsyur/overlay/lib/python3.11/site-packages/hatchling/build.py", line 44, in get_requires_for_build_wheel
          return builder.config.dependencies
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-bb2wsyur/overlay/lib/python3.11/site-packages/hatchling/builders/config.py", line 656, in dependencies
          for dependency in self.dynamic_dependencies:
                            ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/functools.py", line 1001, in __get__
          val = self.func(instance)
                ^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-bb2wsyur/overlay/lib/python3.11/site-packages/hatchling/builders/config.py", line 671, in dynamic_dependencies
          build_hook = build_hook_cls(
                       ^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-bb2wsyur/overlay/lib/python3.11/site-packages/hatchling/builders/hooks/custom.py", line 35, in __new__
          hook_class = load_plugin_from_script(path, build_script, BuildHookInterface, 'build_hook')
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-bb2wsyur/overlay/lib/python3.11/site-packages/hatchling/plugin/utils.py", line 18, in load_plugin_from_script
          spec.loader.exec_module(module)  # type: ignore
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap_external>", line 940, in exec_module
        File "<frozen importlib._bootstrap>", line [24](https://github.com/buddly27/pytest-cmake/actions/runs/8317355309/job/22758020884#step:7:25)1, in _call_with_frames_removed
        File "/home/runner/work/pytest-cmake/pytest-cmake/build_config.py", line 2, in <module>
          import pytest
      ModuleNotFoundError: No module named 'pytest'
      [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.

It seems to be because of the dynamic pytest dependency, which might need to be handled differently: https://github.com/pypa/hatch/pull/1314

buddly27 commented 6 months ago

Fixed via 6aca5ca