Skip to content

Conversation

@yzh119
Copy link
Collaborator

@yzh119 yzh119 commented Oct 30, 2025

📌 Description

The regex cannot recognize release candidates (v0.5.0rc1) or post releases (v1.2.3.post1): https://github.com/flashinfer-ai/flashinfer/actions/runs/18929490991/job/54049304551

This PR fixes the issue.

🔍 Related Issues

https://github.com/flashinfer-ai/flashinfer/actions/runs/18929490991/job/54049304551

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Summary by CodeRabbit

  • Chores
    • Enhanced version string parsing in the wheel package indexing process to support more complex version formats, including pre-release, post-release, and development versions, ensuring compatibility with PEP 440 versioning standards.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yzh119, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in the update_whl_index.py script by enhancing its regular expressions. The script, responsible for parsing wheel filenames and extracting version details, previously failed to recognize certain valid version formats like release candidates and post-releases. The updated regex patterns now align with PEP 440, ensuring robust and accurate parsing of all supported wheel versioning, thereby preventing failures in the wheel index generation process.

Highlights

  • Regex Update for Wheel Version Parsing: The regular expressions used to extract version information from wheel filenames in scripts/update_whl_index.py have been updated. Previously, these regexes could not correctly parse versions including release candidates (e.g., v0.5.0rc1) or post-releases (e.g., v1.2.3.post1), leading to issues in the wheel index update process. The new regexes now fully support PEP 440 versioning schemes, ensuring accurate recognition of these version types.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Walkthrough

The wheel filename parsing regexes in get_package_info were expanded to support PEP 440 version strings with pre-release (a, b, rc), post-release (.post), and dev (.dev) segments across three package types: flashinfer_python, flashinfer_cubin, and flashinfer_jit_cache.

Changes

Cohort / File(s) Summary
Wheel filename regex expansion
scripts/update_whl_index.py
Updated three regex patterns for package type matching to handle extended version strings: flashinfer_python- and flashinfer_cubin- now parse base version with optional pre-release, post-release, and dev segments; flashinfer_jit_cache- includes the same plus a required +cu<digits> CUDA suffix

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify regex patterns correctly match PEP 440 version format
  • Confirm the three patterns are syntactically sound and don't introduce unintended side effects
  • Check that the CUDA suffix requirement (+cu<digits>) for flashinfer_jit_cache- is intentional

Suggested reviewers

  • nvmbreughe

Poem

🐰 Hops through the wheel files with glee,
Regex patterns now wild and free,
Pre-release, post, and dev so divine,
Version strings parse in elegant line!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "bugfix: fix regex in update wheel index script" accurately and specifically describes the main change in the pull request. The raw summary confirms that the changes expand regex patterns in the scripts/update_whl_index.py file to handle more complex version strings including pre-release and post releases. The title is concise, clear, avoids noise, and is specific enough for teammates scanning history to understand the primary change.
Description Check ✅ Passed The PR description follows the repository template structure completely. It includes all required sections: a Description section explaining the problem (regex cannot recognize release candidates and post releases) with specific examples and context; a Related Issues section linking to the failing CI run; completed Pre-commit Checks (all three items marked as done); a Tests section properly reflecting the current state; and an optional Reviewer Notes section. The description provides clear context about what was fixed and why, making it comprehensive and complete.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes an issue with the regular expression used for parsing wheel filenames, extending it to support release candidates and post-releases as per PEP 440. The change successfully addresses the problem described. I've added one suggestion to further improve the robustness of the version parsing and the maintainability of the code by extracting the duplicated regex pattern and making it more specific. Overall, this is a good fix.

match = re.match(r"flashinfer_python-([0-9.]+(?:\.dev\d+)?)-", wheel_name)
# Supports PEP 440: base_version[{a|b|rc}N][.postN][.devN]
match = re.match(
r"flashinfer_python-([0-9.]+(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?)-",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This regex is an improvement, but the base version part [0-9.]+ is too permissive and could match invalid version strings like 1..2 or . which might lead to incorrect behavior.

For improved robustness and maintainability, I suggest two changes:

  1. More specific base version regex: Use [0-9]+(?:\.[0-9]+)* to strictly match dot-separated numbers.
  2. DRY principle: Extract the repeated version pattern into a variable to avoid duplication and make future changes easier.

Here's how you could apply this within the get_package_info function:

# At the top of the function:
pep440_version_part = r"[0-9]+(?:\.[0-9]+)*(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?"

# Then, for each package:
match = re.match(f"flashinfer_python-({pep440_version_part})-", wheel_name)
# ... and so on for the other packages.

This would make the parsing more reliable and the code easier to maintain.

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: 0

🧹 Nitpick comments (3)
scripts/update_whl_index.py (3)

34-38: Regex correctly implements PEP 440 pre-release and post-release support.

The pattern now correctly matches release candidates (e.g., 0.5.0rc1) and post releases (e.g., 1.2.3.post1) as intended. The ordering follows PEP 440 specification.

Optional: Consider stricter base version pattern.

The base version pattern [0-9.]+ is permissive and could theoretically match invalid versions like 1..2 or .1.2. For more robust validation, consider:

-    r"flashinfer_python-([0-9.]+(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?)-",
+    r"flashinfer_python-(\d+(?:\.\d+)*(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?)-",

This ensures at least one digit followed by zero or more .digit groups.


48-52: Regex correctly implements PEP 440 support.

Consistent with the flashinfer_python pattern, this now correctly handles release candidates and post releases.

Optional: Consider stricter base version pattern.

Same as the previous pattern, consider using \d+(?:\.\d+)* for more robust base version validation:

-    r"flashinfer_cubin-([0-9.]+(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?)-",
+    r"flashinfer_cubin-(\d+(?:\.\d+)*(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?)-",

62-66: Regex correctly implements PEP 440 support with CUDA suffix.

The pattern appropriately enforces the CUDA suffix requirement (+cu\d+) while supporting pre-release and post-release segments. The captured version includes the CUDA suffix, which is correctly handled since get_cuda_version() is called separately on line 69.

Optional: Consider stricter base version pattern.

For consistency and robustness, apply the same improvement to the base version pattern:

-    r"flashinfer_jit_cache-([0-9.]+(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?\+cu\d+)-",
+    r"flashinfer_jit_cache-(\d+(?:\.\d+)*(?:(?:a|b|rc)\d+)?(?:\.post\d+)?(?:\.dev\d+)?\+cu\d+)-",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c07921 and dbeb639.

📒 Files selected for processing (1)
  • scripts/update_whl_index.py (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy Docs

Copy link
Collaborator

@bkryu bkryu left a comment

Choose a reason for hiding this comment

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

LGTM. Double checked with Perplexity 😄 :

Previous regex pattern is suitable for simple versioning schemes with optional dev releases.​

Proposed regex pattern is compatible with PEP 440 versioning, capturing most standard Python package release formats, including pre- and post-releases as well as dev snapshots.​ It is strictly more general and is recommended if your input can include alpha, beta, release candidate, post, or development suffixes recognized by Python packaging tools.

@yzh119 yzh119 merged commit b9287c9 into flashinfer-ai:main Oct 30, 2025
4 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.

2 participants