Skip to content

Conversation

@ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented Jan 2, 2026

What does this PR do ?

Adds commit hash into the package version metadata so built wheels/tarballs encode the exact git revision.

  1. uv sync
    image

  2. uv build
    image

  3. uv run python -c "import nemo_automodel; print(nemo_automodel.__version__); print(nemo_automodel.__git_version__)"
    image

Changelog

  • build_backend.py:9-107: new custom build backend that gathers git branch/tag/hash, writes - nemo_automodel/_version.py, and appends the hash to version unless on a release branch or tag; exports git_version.
  • __init__.py:16-25: re-exports git_version alongside version and package_name.
  • package_info.py:15-16: switches to importing version and git_version from the generated _version.py.
  • pyproject.toml:15-33: configures the custom build backend and points the dynamic version source to nemo_automodel._version.version.
  • .gitignore:162-164: ignores the generated nemo_automodel/_version.py.
  • version.txt:1: sets the base package version to 0.2.0.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?

If you haven't finished some of the above items you can still open "Draft" PR.

Additional Information

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 2, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: ooooo <3164076421@qq.com>
@ooooo-create ooooo-create marked this pull request as ready for review January 2, 2026 07:59
Copilot AI review requested due to automatic review settings January 2, 2026 07:59
Copy link

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 implements commit hash tracking in package versions to enable better traceability of installed packages. The implementation uses a custom build backend that generates version metadata from git information at build time.

Key Changes:

  • Introduces a custom build backend (build_backend.py) that wraps setuptools and generates _version.py with git metadata during builds
  • Adds version.txt as the single source of truth for the base package version (0.2.0)
  • Exports __git_version__ alongside __version__ for runtime inspection of the exact commit

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
build_backend.py New custom build backend that generates _version.py with git commit hash, branch, and tag information; wraps setuptools build_meta functions
version.txt New file containing the base package version (0.2.0)
pyproject.toml Configures custom build backend and updates dynamic version source to use generated _version.py
nemo_automodel/package_info.py Replaces hardcoded version constants with imports from generated _version.py
nemo_automodel/init.py Adds git_version to package exports
.gitignore Excludes generated _version.py from version control
MANIFEST.in Includes build_backend.py in source distributions

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

Signed-off-by: ooooo <3164076421@qq.com>
@akoumpa
Copy link
Contributor

akoumpa commented Jan 5, 2026

/ok to test 65eb4a1

@@ -0,0 +1,108 @@
import logging
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for the contribution @ooooo-create ,

I want to move this file out of the top-of-tree. Right now I don't see a directory that's 100% suitable, but perhaps the closest would be test/? @thomasdhc please opine on the matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants