Environment
- Fromager version: Latest on main branch.
e2e7ade Issue is present in released Fromager 0.97.0.
- Python version: 3.14.7.
- OS / architecture: Fedora Linux 44
- Container or local: local checkout, tests run in a Hatch virtual environment
Bug description
Expected behavior:
default_get_build_sdist_dependencies() should call the backend's
get_requires_for_build_sdist() hook and return its requirements.
If that optional hook is absent, the result should be an empty list.
Wheel-specific dependency discovery should not execute in this function.
PEP 517 specifies these as separate hooks:
https://peps.python.org/pep-0517/#get-requires-for-build-sdist
Actual behavior:
The function calls get_requires_for_build_wheel() instead. Its docstring
also refers to the wheel hook.
When the two hooks return different requirements, Fromager returns the
wheel requirements for sdist dependency discovery, omitting sdist-only
requirements. When the sdist hook is absent, it returns wheel requirements
instead of the empty default. If the wheel hook raises, sdist dependency
discovery fails even when the sdist hook works.
Steps to reproduce / logs:
-
Use an in-tree backend with different wheel and sdist requirements:
def get_requires_for_build_wheel(config_settings=None):
return ["wheel-only>=1"]
def get_requires_for_build_sdist(config_settings=None):
return ["sdist-only>=2"]
-
Configure a pyproject_hooks.BuildBackendHookCaller with this backend,
backend_path=["."], and the current Python executable.
-
Call default_get_build_sdist_dependencies() with that caller. The
regression test replaces only the caller factory; pyproject-hooks invokes
the backend in a real subprocess.
-
Observe ["wheel-only>=1"] rather than ["sdist-only>=2"].
Changing the call and matching docstring to get_requires_for_build_sdist()
makes all three pass. The complete dependency test file then passes:
Environment
e2e7adeIssue is present in released Fromager 0.97.0.Bug description
Expected behavior:
default_get_build_sdist_dependencies()should call the backend'sget_requires_for_build_sdist()hook and return its requirements.If that optional hook is absent, the result should be an empty list.
Wheel-specific dependency discovery should not execute in this function.
PEP 517 specifies these as separate hooks:
https://peps.python.org/pep-0517/#get-requires-for-build-sdist
Actual behavior:
The function calls
get_requires_for_build_wheel()instead. Its docstringalso refers to the wheel hook.
When the two hooks return different requirements, Fromager returns the
wheel requirements for sdist dependency discovery, omitting sdist-only
requirements. When the sdist hook is absent, it returns wheel requirements
instead of the empty default. If the wheel hook raises, sdist dependency
discovery fails even when the sdist hook works.
Steps to reproduce / logs:
Use an in-tree backend with different wheel and sdist requirements:
Configure a
pyproject_hooks.BuildBackendHookCallerwith this backend,backend_path=["."], and the current Python executable.Call
default_get_build_sdist_dependencies()with that caller. Theregression test replaces only the caller factory; pyproject-hooks invokes
the backend in a real subprocess.
Observe
["wheel-only>=1"]rather than["sdist-only>=2"].Changing the call and matching docstring to
get_requires_for_build_sdist()makes all three pass. The complete dependency test file then passes: