Skip to content

build: embed source git commit in built package - #1140

Open
smflorentino wants to merge 4 commits into
mainfrom
evals-py-version
Open

smflorentino wants to merge 4 commits into
mainfrom
evals-py-version

Conversation

@smflorentino

@smflorentino smflorentino commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator
  • Adds a hatchling build hook that writes the build's git commit into a published package, so from a given package build we can easily find the commit hash.
  • Adds hatchling as a dev dependency, so there is no difference between dev box and CI.
  • Bump package version.

🤖 Generated with Claude Code

Add a hatchling custom build hook (hatch_build.py) that generates a
git-ignored _version.py at build time, following the setuptools-scm /
hatch-vcs convention: __version__ and __commit_id__ (aliases version,
commit_id). The file ships in both the sdist and the wheel, so an installed
package can report the exact commit it was built from.

The commit is HEAD of the checkout (only when the project is tracked by it);
when building a wheel from an sdist the commit recorded in the sdist is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

smflorentino and others added 3 commits October 8, 2026 13:38
Add hatchling as a dev dependency instead of exempting it from mypy, and
bound the build backend to the same range (hatchling>=1.32,<2) so the
version mypy checks against matches the one that runs the hook. Give
BuildHookInterface its BuilderConfig type argument, which mypy now requires.

uv.lock regenerated with uv 0.12, which also bumps the lockfile format
revision (3 -> 5); no existing package versions change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hook works on any recent hatchling (checked 1.18 through 1.32), isolated
builds always fetch the latest, and uv.lock already pins the dev version, so
the bounds added nothing. build-system requires is back to its original form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

3 participants