Skip to content

[proposal] wheel_build_tag hook for unique wheel file names#1066

Open
tiran wants to merge 1 commit intopython-wheel-build:mainfrom
tiran:proposal-wheel-build-tag-hook
Open

[proposal] wheel_build_tag hook for unique wheel file names#1066
tiran wants to merge 1 commit intopython-wheel-build:mainfrom
tiran:proposal-wheel-build-tag-hook

Conversation

@tiran
Copy link
Copy Markdown
Collaborator

@tiran tiran commented Apr 16, 2026

Pull Request Description

What

Add proposal document for a new hook point that injects platform, accelerator, and ABI suffixes into wheel build tags.

Why

See: #1059

@tiran tiran requested a review from a team as a code owner April 16, 2026 09:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a5a00227-6960-4bfd-b7e8-37ae0c5bf34e

📥 Commits

Reviewing files that changed from the base of the PR and between 20d94ef and e3af312.

📒 Files selected for processing (3)
  • docs/proposals/index.rst
  • docs/proposals/wheel-build-tag-hook.md
  • docs/spelling_wordlist.txt
✅ Files skipped from review due to trivial changes (3)
  • docs/spelling_wordlist.txt
  • docs/proposals/index.rst
  • docs/proposals/wheel-build-tag-hook.md

📝 Walkthrough

Walkthrough

This PR adds documentation: it registers a new proposal wheel-build-tag-hook in the proposals index, introduces docs/proposals/wheel-build-tag-hook.md describing a fromager.hooks stevedore hook (wheel_build_tag) with its runner contract, input/output rules, validation constraints, examples, and entry-point details, and updates docs/spelling_wordlist.txt to include libtorch and stdlib.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title '[proposal] wheel_build_tag hook for unique wheel file names' directly and clearly summarizes the main change: introducing a proposal for a new hook point that creates unique wheel filenames.
Description check ✅ Passed The description explains what is being added (proposal document for a hook point), why (references issue #1059), and confirms adherence to guidelines.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/proposals/wheel-build-tag-hook.md`:
- Around line 121-124: The example hook uses the variable parts when appending
CUDA tag but the accumulator defined earlier is named result, causing an
undefined variable error; update the CUDA branch to append to result (i.e.,
replace parts.append(...) with result.append(...)) and verify other branches
consistently use the same accumulator (referencing ctx.variant and Version(...)
in the function).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 243b235f-4791-4b2e-bff6-6ba1ef0f1db7

📥 Commits

Reviewing files that changed from the base of the PR and between 297ed76 and 20d94ef.

📒 Files selected for processing (3)
  • docs/proposals/index.rst
  • docs/proposals/wheel-build-tag-hook.md
  • docs/spelling_wordlist.txt

Comment thread docs/proposals/wheel-build-tag-hook.md
@tiran tiran force-pushed the proposal-wheel-build-tag-hook branch from 20d94ef to f323ece Compare April 16, 2026 09:39
Copy link
Copy Markdown
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a solid design and will really help us downstream as well!

I left a few comments, after addressing those we can merge this.

Comment thread docs/proposals/wheel-build-tag-hook.md Outdated
req: Requirement,
version: Version,
wheel_tags: frozenset[Tag],
) -> typing.Sequence[str]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Says it returns Sequence[str] but example on ;ine 93-94 returns Sequence[tuple[int, str]]

def example_hook(...) -> typing.Sequence[tuple[int, str]]:

We should ensure the runner's signature matches the hook's return value, or clarify that the runner collects tuples and returns strings

Comment thread docs/proposals/wheel-build-tag-hook.md Outdated
...
```

Each registered hook returns `typing.Sequence[tuple[int, str]]`, a sequence
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification (Dumb) questions: What happens if:
- A hook raises an exception?
- Two hooks return the same sort order integer?
- A hook returns invalid characters (e.g., - which is forbidden)?

platlib = any(tag.platform != "any" for tag in wheel_tags)
if platlib:
# fc43, el9.6, ...
result.append((1, get_distro_tag()))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add how get_distro_tag( ) will look like? Perhaps a pseudocode?

Comment thread docs/proposals/wheel-build-tag-hook.md Outdated
# fc43, el9.6, ...
result.append((1, get_distro_tag()))
pbi = ctx.package_build_info(req)
if pbi.annotations.get("accelerator-specific") == "true":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document annotation requirements as well?

Add proposal document for a new stevedore hook point that injects
platform, accelerator, and ABI suffixes into wheel build tags.

See: python-wheel-build#1059
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran force-pushed the proposal-wheel-build-tag-hook branch from f323ece to e3af312 Compare April 17, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants