Skip to content

Conversation

@LeiWang1999
Copy link
Member

@LeiWang1999 LeiWang1999 commented Jan 27, 2026

Summary

  • Add build_date() utility function to extract build date (YYYYMMDD) from version string
  • Support adding build date suffix to wheel version via TILELANG_BUILD_WHEEL_WITH_DATE environment variable
  • Export build_date at tilelang.build_date() for easy access

Motivation

This feature allows users to programmatically check the build date of their tilelang installation, which is useful for:

  • Verifying they have a recent enough build
  • Debugging version-related issues
  • CI/CD pipelines that need to verify package freshness

Usage Example

import tilelang

# Check if build meets minimum date requirement
if tilelang.build_date() and tilelang.build_date() >= 20260127:
    print("Version meets requirement")

Test plan

  • Verify build_date() correctly parses version strings with date suffix
  • Verify build_date() returns None for versions without date suffix
  • Verify wheel build includes date when TILELANG_BUILD_WHEEL_WITH_DATE=1

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • A new build date utility is now publicly available for extracting build date information from version strings.
    • Version strings can now optionally include build date metadata when configured.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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.
@github-actions
Copy link

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run pre-commit run --all-files in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

A new build date extraction utility is introduced via a tilelang.utils.version module with a build_date() function, exposed through public APIs. The version string generation is updated to optionally append build date information when an environment variable is set.

Changes

Cohort / File(s) Summary
Build Date Utility Module
tilelang/utils/version.py
New module introducing build_date(version_str: str | None = None) -> int | None function that extracts YYYYMMDD format dates from version strings using pattern matching; defaults to tilelang.__version__ if no argument provided
Public API Exports
tilelang/utils/__init__.py, tilelang/__init__.py
Added re-exports of build_date through module hierarchy, making it accessible as tilelang.build_date
Version String Integration
version_provider.py
Appends build date extension (formatted as dYYYYMMDD) to version string when TILELANG_BUILD_WHEEL_WITH_DATE environment variable is truthy

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A date now hops through version strings so bright,
Extracted patterns, formatted just right!
From utils we export, through init we share,
Build dates in wheels floating through the air! 📅✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and directly summarizes the main change: adding build date functionality to version metadata.

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

✨ Finishing touches
  • 📝 Generate docstrings

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
Contributor

@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: 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.

Comment on lines +28 to +31
match = re.search(r"\.d(\d{8})\.", version_str)
if match:
return int(match.group(1))
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

Comment on lines +75 to +78
# 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')}")

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

@LeiWang1999 LeiWang1999 merged commit 2f59613 into tile-ai:main Jan 27, 2026
13 checks passed
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.

1 participant