Skip to content

Commit ddca185

Browse files
Binyang2014Copilotgithub-actions
authored
Address corner case when generating version file (#641)
Address corner case for version file generation --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
1 parent 3d94383 commit ddca185

File tree

6 files changed

+22
-201
lines changed

6 files changed

+22
-201
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.0
1+
0.8.0

_build_version_metadata.py

Lines changed: 0 additions & 135 deletions
This file was deleted.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = "mscclpp"
1010
copyright = "2025, MSCCL++ Team"
1111
author = "MSCCL++ Team"
12-
release = "v0.7.0"
12+
release = "v0.8.0"
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/quickstart.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,17 @@ export LD_LIBRARY_PATH=$MSCCLPP_INSTALL_DIR:$LD_LIBRARY_PATH
206206
torchrun --nnodes=1 --nproc_per_node=8 your_script.py
207207
```
208208
209-
### Version Tracking
209+
## Version Tracking
210210
211211
The MSCCL++ Python package includes comprehensive version tracking that captures git repository information at build time. This feature allows users to identify the exact source code version of their installed package.
212212
213-
#### Version Format
213+
### Version Format
214214
215215
The package version includes the git commit hash directly in the version string for development builds:
216216
- **Release version**: `0.7.0`
217-
- **Development version**: `0.7.0.dev36+g6e2360d69` (includes short commit hash)
218-
- **Development with uncommitted changes**: `0.7.0.dev36+g6e2360d69.dirty`
217+
- **Development version**: `mscclpp-0.8.0.post1.dev0+gc632fee37.d20251007`
219218
220-
#### Checking Version Information
219+
### Checking Version Information
221220
222221
After installation, you can check the version information in several ways:
223222
@@ -227,16 +226,10 @@ import mscclpp
227226
228227
# Access individual attributes
229228
print(f"Version: {mscclpp.__version__}") # Full version with commit
230-
Version: 0.7.0.dev36+g6e2360d69
229+
Version: 0.8.0.post1.dev0+gc632fee37.d20251007
231230
232231
# Get as dictionary
233232
mscclpp.version
234-
{'version': '0.7.0.dev36+g6e2360d69', 'base_version': '0.7.0', 'git_commit': '6e2360d69'}
233+
{'version': '0.8.0.post1.dev0+gc632fee37.d20251007', 'git_commit': 'g50382c567'}
235234
```
236235
237-
#### Version Information Details
238-
239-
The version tracking captures:
240-
- **Package Version** (`mscclpp.__version__`): Full version string including git commit (e.g., `0.7.1.dev36+g6e2360d69`)
241-
242-
This information is embedded during the package build process and remains accessible even after distribution, making it easier to debug issues and ensure reproducibility.

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
[build-system]
55
requires = [
6-
"scikit-build-core>=0.4.3",
7-
"setuptools-scm[toml]>=6.2"
6+
"scikit-build-core>=0.10.0",
7+
"setuptools-scm[toml]>=8"
88
]
9-
build-backend = "_build_version_metadata"
10-
backend-path = ["."]
9+
build-backend = "scikit_build_core.build"
1110

1211
[project]
1312
name = "mscclpp"
@@ -17,6 +16,7 @@ requires-python = ">=3.8"
1716

1817
[tool.setuptools_scm]
1918
write_to = "python/mscclpp/_version.py"
19+
version_scheme = "no-guess-dev"
2020

2121
[tool.scikit-build]
2222
cmake.version = ">=3.25.0"
@@ -31,6 +31,9 @@ install-dir = "mscclpp"
3131
license-files = ["VERSION", "LICENSE", "CITATION.cff", "CODE_OF_CONDUCT.md", "README.md", "SECURITY.md", "SUPPORT.md"]
3232
exclude = ["mscclpp/*.cpp"]
3333

34+
[tool.scikit-build.sdist]
35+
include= ["python/mscclpp/_version.py"]
36+
3437
[tool.scikit-build.cmake.define]
3538
MSCCLPP_BUILD_PYTHON_BINDINGS = "ON"
3639
MSCCLPP_BUILD_TESTS = "OFF"

python/mscclpp/__init__.py

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,21 @@
55

66
import os
77
import warnings
8-
import re
98
from functools import wraps
109

1110

12-
# Get version
13-
def _get_version():
14-
"""Get version from the best available source"""
15-
16-
# Try setuptools-scm generated _version.py (most reliable)
17-
try:
18-
from ._version import __version__
19-
20-
return __version__
21-
except ImportError:
22-
raise RuntimeError("Could not determine MSCCL++ version from setuptools-scm generated _version.py.")
23-
24-
25-
# Parse version components
26-
def _parse_version(version_string):
27-
"""Parse version components from setuptools-scm generated version"""
28-
# Pattern for versions like "0.7.0.dev36+g6e2360d69" (without .dYYYYMMDD)
29-
pattern = r"^v?(?P<base>[\d\.]+)(?:\.dev(?P<distance>\d+))?(?:\+g(?P<commit>[a-f0-9]+))?(?P<dirty>\.dirty)?$"
30-
match = re.match(pattern, version_string)
31-
32-
if match:
33-
return {"base_version": match.group("base"), "git_commit": match.group("commit") or "unknown"}
34-
else:
35-
# Fallback parsing - try to extract what we can
36-
base = version_string.split("+")[0].lstrip("v").split(".dev")[0]
37-
commit = "unknown"
38-
39-
return {"base_version": base, "git_commit": commit}
11+
if os.environ.get("MSCCLPP_HOME", None) is None:
12+
os.environ["MSCCLPP_HOME"] = os.path.abspath(os.path.dirname(__file__))
4013

14+
from ._version import __version__, __commit_id__
4115

42-
__version__ = _get_version()
4316

4417
# Parse the version
45-
_version_info = _parse_version(__version__)
46-
__base_version__ = _version_info["base_version"]
47-
__git_commit__ = _version_info["git_commit"]
48-
49-
50-
def _version():
51-
"""Get complete version information as a dictionary"""
52-
return {
53-
"version": __version__,
54-
"base_version": __base_version__,
55-
"git_commit": __git_commit__,
56-
}
57-
18+
version = {
19+
"version": __version__,
20+
"git_commit": __commit_id__,
21+
}
5822

59-
version: dict = _version()
6023

6124
from ._mscclpp import (
6225
Env,
@@ -132,9 +95,6 @@ def _version():
13295
"SmDevice2DeviceSemaphore",
13396
]
13497

135-
if os.environ.get("MSCCLPP_HOME", None) is None:
136-
os.environ["MSCCLPP_HOME"] = os.path.abspath(os.path.dirname(__file__))
137-
13898

13999
def get_include() -> str:
140100
"""Return the directory that contains the MSCCL++ headers."""

0 commit comments

Comments
 (0)