Skip to content

Commit 4d3b322

Browse files
committed
Backport NVIDIA#1411
1 parent b972c8e commit 4d3b322

10 files changed

Lines changed: 54 additions & 28 deletions

File tree

.github/ISSUE_TEMPLATE/release_checklist.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ body:
2020
- label: File an internal nvbug to communicate test plan & release schedule with QA
2121
- label: Ensure all pending PRs are reviewed, tested, and merged
2222
- label: Check (or update if needed) the dependency requirements
23-
- label: Bump the version
2423
- label: Create a public rc tag
2524
- label: "Point QA to fetch public artifacts (wheels) from the GHA run ID, example: `gh run download 12323257563 -p \"cuda-core*\" -R NVIDIA/cuda-python`"
2625
- label: Wait for QA reports and fix any issues found

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ cuda_bindings/cuda/bindings/nvrtc.pxd
4747
cuda_bindings/cuda/bindings/nvrtc.pyx
4848
cuda_bindings/cuda/bindings/utils/_get_handle.pyx
4949

50+
# Version files from setuptools_scm
51+
_version.py
52+
5053
# Distribution / packaging
5154
.Python
5255
build/

cuda_bindings/cuda/bindings/_version.py

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

cuda_bindings/pyproject.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33

44
[build-system]
5-
requires = ["setuptools>=77.0.0", "cython>=3.2,<3.3", "pyclibrary>=0.1.7"]
5+
requires = [
6+
"setuptools>=80.0.0",
7+
"setuptools-scm[simple]>=8",
8+
"cython>=3.2,<3.3",
9+
"pyclibrary>=0.1.7"
10+
]
611
build-backend = "setuptools.build_meta"
712

813
[project]
@@ -55,7 +60,6 @@ Documentation = "https://nvidia.github.io/cuda-python/"
5560
include = ["cuda*"]
5661

5762
[tool.setuptools.dynamic]
58-
version = { attr = "cuda.bindings._version.__version__" }
5963
readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }
6064

6165
[tool.ruff]
@@ -113,3 +117,10 @@ exclude = ["cuda/bindings/_version.py"]
113117
"UP022",
114118
"E402", # module level import not at top of file
115119
"F841"] # F841 complains about unused variables, but some assignments have side-effects that could be useful for tests (func calls for example)
120+
121+
[tool.setuptools_scm]
122+
root = ".."
123+
version_file = "cuda/bindings/_version.py"
124+
# We deliberately do not want to include the version suffixes (a/b/rc) in cuda-bindings versioning
125+
tag_regex = "^(?P<version>v\\d+\\.\\d+\\.\\d+)"
126+
git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "v*[0-9]*"]

cuda_core/cuda/core/_version.py

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

cuda_core/pyproject.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
[build-system]
6-
requires = ["setuptools>=77.0.0", "Cython>=3.1"]
6+
requires = [
7+
"setuptools>=80.0.0",
8+
"setuptools_scm[simple]>=8",
9+
"Cython>=3.1"
10+
]
711
build-backend = "setuptools.build_meta"
812

913

@@ -65,7 +69,6 @@ include = ["cuda.core*"]
6569
"cuda.core.experimental.include" = ["*.h", "*.hpp", "*.cuh"]
6670

6771
[tool.setuptools.dynamic]
68-
version = { attr = "cuda.core._version.__version__" }
6972
readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }
7073

7174
[tool.ruff]
@@ -106,3 +109,10 @@ exclude = ["cuda/core/_version.py"]
106109
[tool.ruff.lint.per-file-ignores]
107110
"__init__.py" = ["F401"]
108111
"setup.py" = ["F401"]
112+
113+
[tool.setuptools_scm]
114+
root = ".."
115+
version_file = "cuda/core/_version.py"
116+
# We deliberately do not want to include the version suffixes (a/b/rc) in cuda-core versioning
117+
tag_regex = "^cuda-core-(?P<version>v\\d+\\.\\d+\\.\\d+)"
118+
git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--match", "cuda-core-v*[0-9]*"]

cuda_pathfinder/cuda/pathfinder/_version.py

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

cuda_pathfinder/pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,16 @@ version = { attr = "cuda.pathfinder._version.__version__" }
5858
readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }
5959

6060
[build-system]
61-
requires = ["setuptools>=64", "wheel"]
61+
requires = ["setuptools>=80", "setuptools_scm[simple]>=8", "wheel"]
6262
build-backend = "setuptools.build_meta"
6363

64+
[tool.setuptools_scm]
65+
root = ".."
66+
version_file = "cuda/pathfinder/_version.py"
67+
# We deliberately do not want to include the version suffixes (a/b/rc) in cuda-pathfinder versioning
68+
tag_regex = "^cuda-pathfinder-(?P<version>v\\d+\\.\\d+\\.\\d+)"
69+
git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--match", "cuda-pathfinder-v*[0-9]*" ]
70+
6471
[tool.ruff]
6572
line-length = 120
6673
preview = true

cuda_python/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
[build-system]
6-
requires = ["setuptools>=77.0.0",]
6+
requires = ["setuptools>=80.0.0", "setuptools_scm[simple]>=8"]
77
build-backend = "setuptools.build_meta"
88

99
[project]
@@ -41,3 +41,7 @@ issues = "https://github.com/NVIDIA/cuda-python/issues/"
4141

4242
[tool.ruff]
4343
line-length = 120
44+
45+
# The [tool.setuptools_scm] section is handled in setup.py since we need to
46+
# dynamically set the dependency to cuda_bindings based on the dynamically
47+
# determinded version

cuda_python/setup.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
#
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

5-
import ast
5+
from packaging.version import Version
66
from setuptools import setup
7+
from setuptools_scm import get_version
8+
9+
version = get_version(
10+
root="..",
11+
relative_to=__file__,
12+
# We deliberately do not want to include the version suffixes (a/b/rc) in cuda-python versioning
13+
tag_regex="^(?P<version>v\\d+\\.\\d+\\.\\d+)",
14+
git_describe_command=["git", "describe", "--dirty", "--tags", "--long", "--match", "v*[0-9]*"],
15+
)
16+
17+
18+
version = Version(version).base_version
719

8-
# We want to keep the version in sync with cuda.bindings, but setuptools would not let
9-
# us to refer to any files outside of the project root, so we have to employ our own
10-
# run-time lookup using setup()...
11-
with open("../cuda_bindings/cuda/bindings/_version.py") as f:
12-
for line in f:
13-
if line.startswith("__version__"):
14-
version = ast.parse(line).body[0].value.value
1520

1621
setup(
1722
version=version,

0 commit comments

Comments
 (0)