-
Notifications
You must be signed in to change notification settings - Fork 418
[Feature] Add build date to version metadata #1742
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
Conversation
- Introduced functionality to append the build date to the dynamic metadata if the environment variable TILELANG_BUILD_WHEEL_WITH_DATE is set. - Updated imports in tilelang to include the new build_date utility for potential future use.
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
📝 WalkthroughWalkthroughA new build date extraction utility is introduced via a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@tilelang/utils/version.py`:
- Around line 28-31: The regex in tilelang/utils/version.py that searches
version_str currently requires a trailing dot after the date (r"\.d(\d{8})\."),
so it fails for strings where the date is the final segment; update the pattern
used in the re.search call to accept either a trailing dot or the end of the
string (i.e., allow ".dYYYYMMDD" followed by a dot OR end-of-string), leaving
the rest of the logic (using match.group(1) and returning int or None)
unchanged.
In `@version_provider.py`:
- Around line 75-78: The build_date() regex in tilelang/utils/version.py fails
when the date is the last extension (e.g., 0.1.7+cuda.d20260127) because it
requires a trailing dot; update the pattern used in build_date() to allow either
a dot or end-of-string (make the trailing dot optional) so it matches
`\.d(\d{8})(?:\.|$)` (or equivalent), ensuring the function correctly returns
the date when NO_GIT_VERSION or similar makes the date the final segment.
| match = re.search(r"\.d(\d{8})\.", version_str) | ||
| if match: | ||
| return int(match.group(1)) | ||
| return None |
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.
Regex pattern requires trailing dot — see related comment in version_provider.py.
As noted in the version_provider.py review, this pattern won't match version strings where the date is the final segment (e.g., 0.1.7+cuda.d20260127).
Suggested fix
- match = re.search(r"\.d(\d{8})\.", version_str)
+ match = re.search(r"\.d(\d{8})(?:\.|$)", version_str)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| match = re.search(r"\.d(\d{8})\.", version_str) | |
| if match: | |
| return int(match.group(1)) | |
| return None | |
| match = re.search(r"\.d(\d{8})(?:\.|$)", version_str) | |
| if match: | |
| return int(match.group(1)) | |
| return None |
🤖 Prompt for AI Agents
In `@tilelang/utils/version.py` around lines 28 - 31, The regex in
tilelang/utils/version.py that searches version_str currently requires a
trailing dot after the date (r"\.d(\d{8})\."), so it fails for strings where the
date is the final segment; update the pattern used in the re.search call to
accept either a trailing dot or the end of the string (i.e., allow ".dYYYYMMDD"
followed by a dot OR end-of-string), leaving the rest of the logic (using
match.group(1) and returning int or None) unchanged.
| # Add build date if TILELANG_BUILD_WHEEL_WITH_DATE is set | ||
| if _read_cmake_bool(os.environ.get("TILELANG_BUILD_WHEEL_WITH_DATE")): | ||
| exts.append(f"d{time.strftime('%Y%m%d')}") | ||
|
|
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.
Potential regex mismatch when date is the last extension.
The build_date() function in tilelang/utils/version.py uses the regex \.d(\d{8})\. which requires a trailing dot after the date. However, if NO_GIT_VERSION is set (or git hash is unavailable), the date becomes the last extension and the version string would be like 0.1.7+cuda.d20260127 — no trailing dot, so build_date() returns None.
Consider updating the regex in version.py to make the trailing dot optional, or ensure the date is never the last segment.
Suggested fix in tilelang/utils/version.py
- match = re.search(r"\.d(\d{8})\.", version_str)
+ match = re.search(r"\.d(\d{8})(?:\.|$)", version_str)This allows matching when the date is followed by either a dot or end-of-string.
🤖 Prompt for AI Agents
In `@version_provider.py` around lines 75 - 78, The build_date() regex in
tilelang/utils/version.py fails when the date is the last extension (e.g.,
0.1.7+cuda.d20260127) because it requires a trailing dot; update the pattern
used in build_date() to allow either a dot or end-of-string (make the trailing
dot optional) so it matches `\.d(\d{8})(?:\.|$)` (or equivalent), ensuring the
function correctly returns the date when NO_GIT_VERSION or similar makes the
date the final segment.
Summary
build_date()utility function to extract build date (YYYYMMDD) from version stringTILELANG_BUILD_WHEEL_WITH_DATEenvironment variablebuild_dateattilelang.build_date()for easy accessMotivation
This feature allows users to programmatically check the build date of their tilelang installation, which is useful for:
Usage Example
Test plan
build_date()correctly parses version strings with date suffixbuild_date()returns None for versions without date suffixTILELANG_BUILD_WHEEL_WITH_DATE=1🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.