-
Notifications
You must be signed in to change notification settings - Fork 42
feat: support commit hash in package version #1005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0c559d0 to
fc2ced0
Compare
Signed-off-by: ooooo <3164076421@qq.com>
fc2ced0 to
90d4a0d
Compare
There was a problem hiding this 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.pywith 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>
|
/ok to test 65eb4a1 |
| @@ -0,0 +1,108 @@ | |||
| import logging | |||
There was a problem hiding this comment.
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.
What does this PR do ?
Adds commit hash into the package version metadata so built wheels/tarballs encode the exact git revision.
uv syncuv builduv run python -c "import nemo_automodel; print(nemo_automodel.__version__); print(nemo_automodel.__git_version__)"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:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information