Skip to content

Commit a53b69f

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

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.github/scripts/update_version.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
version_file="assets/version.txt"
21
init_file="torchtitan/__init__.py"
2+
pyproject_file="pyproject.toml"
33
if [[ -n "$BUILD_VERSION" ]]; then
4-
# Update the version in version.txt
5-
echo "$BUILD_VERSION" > "$version_file"
64
# Create a variable named __version__ at the end of __init__.py
75
echo "__version__ = \"$BUILD_VERSION\"" >> "$init_file"
6+
# Replace dynamic version with fixed version in pyproject.toml
7+
sed -i '' 's/dynamic = \["version"\]/version = "'"$BUILD_VERSION"'"/' "$pyproject_file"
88
else
99
echo "Error: BUILD_VERSION environment variable is not set or empty."
1010
exit 1

assets/version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Stable Releases
22
Currently we follow a lightweight release process.
3-
- Update the version number in `assets/version.txt` with a PR. The version numbering should follow https://semver.org/.
3+
- Pick a version for the release. The version numbering should follow https://semver.org/.
44
- E.g. for a pre-release `0.y.z`
55
- if major features are added, increment `y`
66
- if minor fixes are added, increment `z`

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,27 @@ dev = [
4242
"expecttest", # test_tokenizer
4343
]
4444

45-
[tool.setuptools.dynamic]
46-
version = {file = "assets/version.txt"}
47-
4845
[tool.codespell]
4946
skip = ["*.json"]
5047
ignore-words-list = ["assertin", "datas" ,"indx", "inpt", "nd", "socio-economic"]
5148

5249
# ---- Explicit project build information ---- #
5350
[build-system]
54-
requires = ["setuptools>=61.0"]
51+
requires = ["setuptools>=61.0", "versioningit>=3.3"]
5552
build-backend = "setuptools.build_meta"
5653

5754
[tool.setuptools.packages.find]
5855
where = [""]
5956
include = ["torchtitan*"]
6057

58+
[tool.versioningit.tag2version]
59+
rmprefix = "v"
60+
61+
[tool.versioningit.format]
62+
distance = "{base_version}+git{rev}"
63+
dirty = "{base_version}+git{rev}.dirty"
64+
distance-dirty = "{base_version}+git{rev}.dirty"
65+
6166
[tool.pytest.ini_options]
6267
addopts = ["--showlocals"] # show local variables in tracebacks
6368
testpaths = ["tests"]

0 commit comments

Comments
 (0)