Skip to content

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Nov 28, 2025

User description

  • Use hatch-vcs to automatically derive version from Git tags
  • Remove hardcoded version number from pyproject.toml
  • Version will now be automatically extracted from latest Git tag
  • Eliminates need to manually update version in pyproject.toml

CodeAnt-AI Description

Derive package version from Git tags automatically

What Changed

  • The project no longer hardcodes a version number in pyproject, instead version metadata is pulled from Git tags
  • Hatch now writes the resolved version into mfc/_version.py so packaging and runtime see the Git-derived number
  • The build requirements include hatch-vcs to keep the version synced with the latest tagged commit

Impact

✅ Fewer manual version updates
✅ Consistent published versions
✅ Clearer release metadata from tags

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Chores
    • Switched to VCS-based dynamic versioning so package version is determined from source control at build time.
    • Build now auto-generates a version file during packaging.
    • Added .gitignore entry to exclude the auto-generated version file from source control.

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

- Use hatch-vcs to automatically derive version from Git tags
- Remove hardcoded version number from pyproject.toml
- Version will now be automatically extracted from latest Git tag
- Eliminates need to manually update version in pyproject.toml
Copilot AI review requested due to automatic review settings November 28, 2025 13:22
@codeant-ai
Copy link

codeant-ai bot commented Nov 28, 2025

CodeAnt AI is reviewing your PR.

@qodo-code-review
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Build Bug

Adding hatch-vcs requires that Git metadata is available during builds; sdist/wheel builds in environments without a .git directory may fail unless version fallback is configured or version file is included in sdist.

requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "mfc"
dynamic = ["version"]
dependencies = [
Packaging Consistency

Ensure the generated mfc/_version.py is included in source distributions and read by runtime code; otherwise importing version at runtime may fail outside Git checkouts.

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "mfc/_version.py"
Tooling Compatibility

Downstream tools expecting a static version field may break; verify that dynamic version works with your CI publishing flow and any plugins that parse pyproject metadata.

dynamic = ["version"]
dependencies = [

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Build configuration switched to VCS-driven dynamic versioning: hatch-vcs was added and configured to produce a version file at mfc/_version.py; the project version field was changed to dynamic. .gitignore was updated to ignore the generated version file.

Changes

Cohort / File(s) Change Summary
VCS-based versioning configuration
toolchain/pyproject.toml
Added hatch-vcs to build-system.requires; removed static project.version in favor of dynamic = ["version"]; added [tool.hatch.version] with source = "vcs", [tool.hatch.version.raw-options] pointing to mfc/_version.py, and [tool.hatch.build.hooks.vcs] with version-file = "mfc/_version.py".
Ignored generated version file
.gitignore
Added ignore entry for the generated version file: toolchain/mfc/_version.py.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review toolchain/pyproject.toml sections for correct TOML syntax and paths for version_file and root/relative_to.
  • Confirm .gitignore pattern matches the actual generated path and repository layout.

Poem

🐇 I sniffed the tags and danced with glee,
Versions born from branches, not from me.
Hatch spun numbers, tidy and spry,
A little .gitignore winked goodbye.
*twirls a carrot-shaped commit*

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a summary of changes and motivation, but lacks critical information: no issue reference, no specific test confirmation, missing Type of change checkbox selection, and no indication of testing performed. Add issue reference (if applicable), clearly specify the Type of change, describe testing performed, and confirm relevant checklist items from the template were completed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main objective of the pull request—enabling automatic versioning from Git tags—which aligns with the primary changes in toolchain/pyproject.toml.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51b4eb5 and 76fbc37.

📒 Files selected for processing (2)
  • .gitignore (1 hunks)
  • toolchain/pyproject.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • toolchain/pyproject.toml
⏰ 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). (9)
  • GitHub Check: Github (ubuntu, no-mpi, single, no-debug, false)
  • GitHub Check: Github (ubuntu, mpi, no-debug, true)
  • GitHub Check: Github (ubuntu, mpi, no-debug, false)
  • GitHub Check: Github (ubuntu, mpi, debug, false)
  • GitHub Check: Github (ubuntu, mpi, debug, true)
  • GitHub Check: Coverage Test on CodeCov
  • GitHub Check: Code Cleanliness Check
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Build & Publish
🔇 Additional comments (1)
.gitignore (1)

22-23: I'm unable to access the repository or retrieve concrete details about PR #1064 due to technical limitations. However, based on the original review comment's observation, there is a documented discrepancy that needs verification:

The .gitignore path inconsistency cannot be definitively resolved without access to pyproject.toml's hatch-vcs configuration.

The original review comment correctly identifies a potential issue: the .gitignore entry specifies toolchain/mfc/_version.py, but PR objectives and summaries reference mfc/_version.py (without the toolchain/ prefix). This mismatch must be verified against the actual hatch-vcs configuration.

Verify that the version file path in .gitignore matches the configured path in pyproject.toml's hatch-vcs settings. The entry at line 23 specifies toolchain/mfc/_version.py, but PR documentation references mfc/_version.py. Confirm which path is correct by checking the [tool.hatch.version] or build hook configuration.


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

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Nov 28, 2025
@codeant-ai
Copy link

codeant-ai bot commented Nov 28, 2025

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copilot finished reviewing on behalf of sbryngelson November 28, 2025 13:25
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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e25dbc4 and 51b4eb5.

📒 Files selected for processing (1)
  • toolchain/pyproject.toml (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Lint Source
toolchain/pyproject.toml

[error] 1-1: Metadata generation failed: setuptools-scm could not detect version for 'toolchain'; set root or enable search_parent_directories in setuptools_scm, or run from the repository root. Exit code 1 during 'Preparing metadata (pyproject.toml)'.

🪛 GitHub Actions: Lint Toolchain
toolchain/pyproject.toml

[error] 1-1: Metadata generation failed during wheel build: setuptools-scm could not detect version for /home/runner/work/MFC/MFC/toolchain. The failure occurred while preparing metadata for build wheel (pyproject.toml). Exit code: 1. Suggested fixes: set relative_to/root in setuptools-scm config or run from repository root.

⏰ 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). (4)
  • GitHub Check: Github (macos, mpi, debug, false)
  • GitHub Check: Agent
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Build & Publish

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes MFC's Python package versioning by implementing automatic version derivation from Git tags using hatch-vcs. The changes eliminate the need to manually update version numbers in pyproject.toml, instead allowing the build system to automatically extract version information from Git tags.

Key changes:

  • Adds hatch-vcs dependency to the build system
  • Converts the version field to be dynamically derived from Git tags
  • Configures hatch-vcs to generate a _version.py file containing the version information

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.36%. Comparing base (e25dbc4) to head (76fbc37).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1064   +/-   ##
=======================================
  Coverage   44.36%   44.36%           
=======================================
  Files          71       71           
  Lines       20590    20590           
  Branches     1994     1994           
=======================================
  Hits         9134     9134           
  Misses      10310    10310           
  Partials     1146     1146           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson sbryngelson merged commit ec01fb7 into MFlowCode:master Nov 28, 2025
32 of 37 checks passed
@sbryngelson sbryngelson deleted the auto-version-from-git-tags branch November 29, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 2/5 size:XS This PR changes 0-9 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

1 participant