Skip to content

fix(release): pin build version via SETUPTOOLS_SCM_PRETEND_VERSION#6

Merged
polaz merged 1 commit intomainfrom
fix/#6-release-build-version
Apr 9, 2026
Merged

fix(release): pin build version via SETUPTOOLS_SCM_PRETEND_VERSION#6
polaz merged 1 commit intomainfrom
fix/#6-release-build-version

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Apr 9, 2026

Summary

  • hatch-vcs detects dirty working tree (submodule state at checkout) and appends local version identifier
  • All 3 packages were built as 0.4.1.dev0+gca4e2abe0.d20260409 instead of 0.4.0
  • PyPI rejects packages with local version identifiers (+... suffix)

Fix

Set SETUPTOOLS_SCM_PRETEND_VERSION env var in the build step, stripping v prefix from tag name (v0.4.00.4.0). This forces hatch-vcs to use the exact tag version regardless of working tree state.

After merge

Will need to re-tag v0.4.0 on the new merge commit to trigger Release workflow with the fixed workflow file.

hatch-vcs detects dirty working tree (submodule state) and appends
local version identifier, producing 0.4.1.dev0+g<hash>.d<date> instead
of the clean tag version. Force the correct version from the tag name.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5ded45f8-7ca0-4483-b65a-91cb4dc21588

📥 Commits

Reviewing files that changed from the base of the PR and between ca4e2ab and ea7d09a.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved the release build process for more reliable version handling during package builds.

Walkthrough

Updated the GitHub Actions release workflow to set the SETUPTOOLS_SCM_PRETEND_VERSION environment variable from the pushed tag before building. The build command now runs through a shell script that extracts the version from GITHUB_REF_NAME and passes it to the build process.

Changes

Cohort / File(s) Summary
GitHub Actions Release Workflow
.github/workflows/release.yml
Modified the "Build wheel + sdist" step to set SETUPTOOLS_SCM_PRETEND_VERSION environment variable from the git tag (${GITHUB_REF_NAME#v}) before executing uv run python -m build, replacing the previous direct command invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing the release build process by pinning the version via SETUPTOOLS_SCM_PRETEND_VERSION environment variable.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem (dirty working tree causing unwanted local version identifiers), the fix (setting SETUPTOOLS_SCM_PRETEND_VERSION), and post-merge actions required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#6-release-build-version

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

@polaz polaz requested a review from Copilot April 9, 2026 13:31
@polaz polaz merged commit 0194b34 into main Apr 9, 2026
8 of 9 checks passed
Copy link
Copy Markdown

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

Updates the release workflow to ensure reproducible, PyPI-acceptable package versions when building from git tags in a potentially “dirty” checkout (e.g., due to submodule state), aligning hatch-vcs/setuptools_scm output with the tag version.

Changes:

  • Pins the build-time version by setting SETUPTOOLS_SCM_PRETEND_VERSION from the pushed tag name (with the leading v stripped).
  • Ensures wheels/sdists are built with the exact tag version even if the working tree is detected as dirty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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