Skip to content

Commit 2fde17b

Browse files
ko3n1gclaude
authored andcommitted
build: drop rc0 pre-release tag and add dynamic git versioning (NVIDIA-NeMo#1729)
* build: drop rc0 pre-release tag and add dynamic git versioning Append +<short-sha> to __version__ at import time using only the git binary. Falls back silently if git is unavailable or not in a repo. Set NO_VCS_VERSION=1 to opt out (e.g. for release builds). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com> * ci: pin build-test-publish-wheel to FW-CI-templates@7a6fd6d Temporarily pins to the commit that sets NO_VCS_VERSION=1 in the build step, fixing the sdist/wheel version mismatch introduced by dynamic git versioning. Will be replaced with a version tag once FW-CI-templates NVIDIA-NeMo/FW-CI-templates#443 is released. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com> * style: add blank line before if block (ruff E303) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com> * fix: suppress I001 import-sorting false positive in package_info.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com> * ci: pin FW-CI-templates to v0.88.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com> --------- Signed-off-by: oliver könig <okoenig@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 07123bd commit 2fde17b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/workflows/build-test-publish-wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
if: |
4040
!(needs.pre-flight.outputs.docs_only == 'true'
4141
|| needs.pre-flight.outputs.is_deployment_workflow == 'true')
42-
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_test_publish_wheel.yml@v0.48.0
42+
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_test_publish_wheel.yml@v0.88.1
4343
with:
4444
dry-run: true
4545
python-package: nemo_automodel

nemo_automodel/package_info.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,32 @@
1616
MAJOR = 0
1717
MINOR = 4
1818
PATCH = 0
19-
PRE_RELEASE = "rc0"
19+
PRE_RELEASE = ""
2020

2121
# Use the following formatting: (major, minor, patch, pre-release)
2222
VERSION = (MAJOR, MINOR, PATCH, PRE_RELEASE)
2323

2424
__shortversion__ = ".".join(map(str, VERSION[:3]))
2525
__version__ = ".".join(map(str, VERSION[:3])) + "".join(VERSION[3:])
2626

27+
import os as _os # noqa: I001
28+
import subprocess as _subprocess
29+
30+
31+
if not int(_os.getenv("NO_VCS_VERSION", "0")):
32+
try:
33+
_git = _subprocess.run(
34+
["git", "rev-parse", "--short", "HEAD"],
35+
capture_output=True,
36+
cwd=_os.path.dirname(_os.path.abspath(__file__)),
37+
check=True,
38+
universal_newlines=True,
39+
)
40+
except (_subprocess.CalledProcessError, OSError):
41+
pass
42+
else:
43+
__version__ += f"+{_git.stdout.strip()}"
44+
2745
__package_name__ = "nemo_automodel"
2846
__contact_names__ = "NVIDIA"
2947
__contact_emails__ = "nemo-toolkit@nvidia.com"

0 commit comments

Comments
 (0)