Description
After updating to pyproject_hooks 1.2.0, I am getting the following error when building setuptools_scm:
> /usr/bin/python3.9 -m build -n
* Getting build dependencies for sdist...
/scratch/userland-gate/components/python/setuptools_scm/setuptools_scm-8.1.0/src/setuptools_scm/_integration/setuptools.py:31: RuntimeWarning:
ERROR: setuptools==8.1.0 is used in combination with setuptools_scm>=8.x
even though my setuptools version is 73.0.1. The build process erroneously takes the setuptools_scm version and considers it the setuptools one.
(while this says ERROR, the build continues and finishes successfully; the only unexpected result is that the WHEEL file lists Generator
as setuptools (8.1.0)
, which is not the case).
I also noticed similar issue with Python incremental.
I know very little about how the whole build machinery works, but I looked a little into this and found that the def find_distributions
addition in 1.2.0 is the reason for this. It seems that importlib_metadata (which is used by setuptools to find its own __version__
) uses _BackendPathFinder
and the new find_distributions
, but the passed context
(which is correctly set to look for "setuptools") is ignored and replaced with new context, which is no longer correct for that case.
Updating the function with a check:
if context is None:
context = DistributionFinder.Context(path=self.backend_path)
fixes the issue, but I have no idea whether that is a good idea - it was just a test.
This happens in 3.9.21 (with importlib_metadata 7.1.0), 3.11.11 and 3.13.1.
Also, both setuptools_scm and incremental use custom build backend and "backend-path" (with more than just ".").