-
Notifications
You must be signed in to change notification settings - Fork 296
Accept post-release wheel versions in release validation #2178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fallintoplace
wants to merge
1
commit into
NVIDIA:main
Choose a base branch
from
fallintoplace:fix-post-release-wheel-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−18
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,12 @@ | |
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import re | ||
| import sys | ||
| from collections import defaultdict | ||
| from pathlib import Path | ||
|
|
||
| from check_release_notes import parse_version_from_tag | ||
|
|
||
| COMPONENT_TO_DISTRIBUTIONS: dict[str, set[str]] = { | ||
| "cuda-core": {"cuda_core"}, | ||
| "cuda-bindings": {"cuda_bindings"}, | ||
|
|
@@ -22,14 +23,16 @@ COMPONENT_TO_DISTRIBUTIONS: dict[str, set[str]] = { | |
| "all": {"cuda_core", "cuda_bindings", "cuda_pathfinder", "cuda_python"}, | ||
| } | ||
|
|
||
| TAG_PATTERNS = ( | ||
| re.compile(r"^v(?P<version>\d+\.\d+\.\d+)"), | ||
| re.compile(r"^cuda-core-v(?P<version>\d+\.\d+\.\d+)"), | ||
| re.compile(r"^cuda-pathfinder-v(?P<version>\d+\.\d+\.\d+)"), | ||
| ) | ||
| COMPONENT_TO_TAG_COMPONENTS: dict[str, tuple[str, ...]] = { | ||
| "cuda-core": ("cuda-core",), | ||
| "cuda-bindings": ("cuda-bindings",), | ||
| "cuda-pathfinder": ("cuda-pathfinder",), | ||
| "cuda-python": ("cuda-python",), | ||
| "all": ("cuda-core", "cuda-bindings", "cuda-pathfinder", "cuda-python"), | ||
| } | ||
|
|
||
|
|
||
| def parse_args() -> argparse.Namespace: | ||
| def parse_args(argv: list[str] | None = None) -> argparse.Namespace: | ||
| parser = argparse.ArgumentParser( | ||
| description=( | ||
| "Validate that wheel versions match the release tag. " | ||
|
|
@@ -39,18 +42,21 @@ def parse_args() -> argparse.Namespace: | |
| parser.add_argument("git_tag", help="Release git tag (for example: v13.0.0)") | ||
| parser.add_argument("component", choices=sorted(COMPONENT_TO_DISTRIBUTIONS.keys())) | ||
| parser.add_argument("wheel_dir", help="Directory containing wheel files") | ||
| return parser.parse_args() | ||
| return parser.parse_args(argv) | ||
|
|
||
|
|
||
| def version_from_tag(tag: str) -> str: | ||
| for pattern in TAG_PATTERNS: | ||
| match = pattern.match(tag) | ||
| if match: | ||
| return match.group("version") | ||
| def version_from_tag(tag: str, component: str) -> str: | ||
| versions = { | ||
| version | ||
| for tag_component in COMPONENT_TO_TAG_COMPONENTS[component] | ||
| if (version := parse_version_from_tag(tag, tag_component)) is not None | ||
| } | ||
| if len(versions) == 1: | ||
| return versions.pop() | ||
| raise ValueError( | ||
| "Unsupported git tag format " | ||
| f"{tag!r}; expected tags beginning with vX.Y.Z, cuda-core-vX.Y.Z, " | ||
| "or cuda-pathfinder-vX.Y.Z." | ||
| f"{tag!r} for component {component!r}; expected vX.Y.Z, cuda-core-vX.Y.Z, " | ||
| "or cuda-pathfinder-vX.Y.Z with a valid release version." | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -62,9 +68,14 @@ def parse_wheel_dist_and_version(path: Path) -> tuple[str, str]: | |
| return parts[0], parts[1] | ||
|
|
||
|
|
||
| def main() -> int: | ||
| args = parse_args() | ||
| expected_version = version_from_tag(args.git_tag) | ||
| def main(argv: list[str] | None = None) -> int: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| args = parse_args(argv) | ||
| try: | ||
| expected_version = version_from_tag(args.git_tag, args.component) | ||
| except ValueError as exc: | ||
| print(f"Error: {exc}", file=sys.stderr) | ||
| return 1 | ||
|
|
||
| expected_distributions = COMPONENT_TO_DISTRIBUTIONS[args.component] | ||
| wheel_dir = Path(args.wheel_dir) | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message still says
vX.Y.Zonly and doesn't reflect the new.postNsupport, so the error contradicts the behavior. SuggestvX.Y.Z[.postN](and the same for the prefixed variants), or drop the format examples and reference the canonical tag rules.