Skip to content

Commit 6c3e953

Browse files
authored
Add git commit to the version as a suffix (#4812)
It's very common that we need to figure out the exact commit from which the current installed triton package is compiled. Right now it will just show a version number like `3.0.0` which isn't quite helpful. With this commit we have ``` > pip show triton Name: triton Version: 3.0.0+git78e4f837 ```
1 parent 49266aa commit 6c3e953

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

python/setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,17 @@ def get_entry_points():
637637
return entry_points
638638

639639

640+
def get_git_commit_hash(length=8):
641+
try:
642+
cmd = ['git', 'rev-parse', f'--short={length}', 'HEAD']
643+
return "+git{}".format(subprocess.check_output(cmd).strip().decode('utf-8'))
644+
except Exception:
645+
return ""
646+
647+
640648
setup(
641649
name=os.environ.get("TRITON_WHEEL_NAME", "triton"),
642-
version="3.0.0" + os.environ.get("TRITON_WHEEL_VERSION_SUFFIX", ""),
650+
version="3.0.0" + get_git_commit_hash() + os.environ.get("TRITON_WHEEL_VERSION_SUFFIX", ""),
643651
author="Philippe Tillet",
644652
author_email="[email protected]",
645653
description="A language and compiler for custom Deep Learning operations",

0 commit comments

Comments
 (0)