Summary
Implement the accepted proposal from PR #1066 (docs/proposals/wheel-build-tag-hook.md).
Tracking issue: #1059
Requirements
-
Global settings: Add a wheels section to the global settings file with a build_tag_hook field (ImportString via Pydantic) that points to a callable.
wheels:
build_tag_hook: "mypackage.hooks:build_tag_hook"
-
Hook signature: The configured callable receives ctx, req, version, and wheel_tags (all keyword-only) and returns Sequence[str] — ordered suffix segments like ["el9.6", "rocm7.1", "torch2.10.0"].
def build_tag_hook(
*,
ctx: context.WorkContext,
req: Requirement,
version: Version,
wheel_tags: frozenset[Tag],
) -> typing.Sequence[str]:
...
-
Suffix construction: Join returned segments with _ and append to the existing numeric build tag (e.g. 8 → 8_el9.6_rocm7.1).
-
Validation: Each segment must match [a-zA-Z0-9.] only. Fail the build on invalid characters or hook exceptions.
-
No-op default: When build_tag_hook is unset, no suffix is appended (current behavior preserved).
-
No wheel content access: The hook must not depend on wheel content, build env, or ELF info — it must produce the same result whether building fresh or retrieving from cache.
References
Summary
Implement the accepted proposal from PR #1066 (
docs/proposals/wheel-build-tag-hook.md).Tracking issue: #1059
Requirements
Global settings: Add a
wheelssection to the global settings file with abuild_tag_hookfield (ImportStringvia Pydantic) that points to a callable.Hook signature: The configured callable receives
ctx,req,version, andwheel_tags(all keyword-only) and returnsSequence[str]— ordered suffix segments like["el9.6", "rocm7.1", "torch2.10.0"].Suffix construction: Join returned segments with
_and append to the existing numeric build tag (e.g.8→8_el9.6_rocm7.1).Validation: Each segment must match
[a-zA-Z0-9.]only. Fail the build on invalid characters or hook exceptions.No-op default: When
build_tag_hookis unset, no suffix is appended (current behavior preserved).No wheel content access: The hook must not depend on wheel content, build env, or ELF info — it must produce the same result whether building fresh or retrieving from cache.
References
wheel_build_taghook #1059