Skip to content

Commit eb2ddbf

Browse files
committed
Add git SHA to wheel versions using setuptools_scm
Signed-off-by: jbernloehr <[email protected]>
1 parent 58fa181 commit eb2ddbf

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

pyproject.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,32 @@ dev = [
4242
"expecttest", # test_tokenizer
4343
]
4444

45-
[tool.setuptools.dynamic]
46-
version = {file = "assets/version.txt"}
45+
[tool.setuptools_scm]
46+
# Automatically generate version from git tags and commits at BUILD TIME
47+
# Development builds: 0.2.0.post77+gf5e3a84e (77 commits after v0.2.0 tag)
48+
# Tagged releases: 0.2.0 (when building from a git tag)
49+
# To override version for releases: set SETUPTOOLS_SCM_PRETEND_VERSION=x.y.z
50+
# This writes the version to torchtitan/_version.py during wheel build
51+
version_file = "torchtitan/_version.py"
52+
version_file_template = """\
53+
# Copyright (c) Meta Platforms, Inc. and affiliates.
54+
# All rights reserved.
55+
# This source code is licensed under the license found in the
56+
# LICENSE file in the root directory of this source tree.
57+
58+
# This file is generated by setuptools_scm at build time
59+
# DO NOT EDIT - it will be overwritten during the build process
60+
__version__ = "{version}"
61+
"""
62+
tag_regex = "^(?P<prefix>v)?(?P<version>[^\\+]+)(?P<suffix>.*)?$"
4763

4864
[tool.codespell]
4965
skip = ["*.json"]
5066
ignore-words-list = ["assertin", "datas" ,"indx", "inpt", "nd", "socio-economic"]
5167

5268
# ---- Explicit project build information ---- #
5369
[build-system]
54-
requires = ["setuptools>=61.0"]
70+
requires = ["setuptools>=61.0", "setuptools-scm>=8.0"]
5571
build-backend = "setuptools.build_meta"
5672

5773
[tool.setuptools.packages.find]

torchtitan/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66

77
# Import to register quantization modules.
88
import torchtitan.components.quantization # noqa: F401
9+
from torchtitan._version import __version__
10+
11+
__all__ = ["__version__"]

torchtitan/_version.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# This file is generated by setuptools_scm at build time
8+
# DO NOT EDIT - it will be overwritten during the build process
9+
__version__ = "0.2.0+unknown"

0 commit comments

Comments
 (0)