Skip to content

Commit 022eea6

Browse files
Use hatch-vcs for dynamic version numbering from git (#106)
Closes #102
1 parent 2f2fcd2 commit 022eea6

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,5 @@ dmypy.json
139139

140140
# Cython debug symbols
141141
cython_debug/
142+
143+
_version.py

VERSION

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

ci/build_python.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ source rapids-date-string
77

88
rapids-print-env
99

10-
RAPIDS_PACKAGE_VERSION=$(head -1 ./VERSION)
10+
rapids-mamba-retry install \
11+
--yes \
12+
'hatchling' 'hatch-vcs'
13+
RAPIDS_PACKAGE_VERSION=$(hatchling version)
1114
export RAPIDS_PACKAGE_VERSION
1215

1316
# populates `RATTLER_CHANNELS` array and `RATTLER_ARGS` array

conda/recipes/rapids-cli/recipe.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ requirements:
2727
host:
2828
- python
2929
- pip
30-
- setuptools >=77.0.0
30+
- hatchling
31+
- hatch-vcs
3132
run:
3233
- python
3334
- importlib-metadata >=4.13.0

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
[build-system]
2-
requires = [
3-
"setuptools>=77.0.0",
4-
"wheel",
5-
]
6-
build-backend = "setuptools.build_meta"
7-
81
[project]
92
name = "rapids-cli"
103
description = "A CLI for RAPIDS"
@@ -40,8 +33,15 @@ nvlink_status = "rapids_cli.doctor.checks.nvlink:check_nvlink_status"
4033
Homepage = "https://github.com/rapidsai/rapids-cli"
4134
Source = "https://github.com/rapidsai/rapids-cli"
4235

43-
[tool.setuptools.dynamic]
44-
version = {file = "VERSION"}
36+
[build-system]
37+
requires = ["hatchling", "hatch-vcs"]
38+
build-backend = "hatchling.build"
39+
40+
[tool.hatch.build.hooks.vcs]
41+
version-file = "rapids_cli/_version.py"
42+
43+
[tool.hatch.version]
44+
source = "vcs"
4545

4646
[tool.setuptools.packages.find]
4747
include = [

rapids_cli/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
# All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44
"""RAPIDS CLI is a command-line interface for managing RAPIDS projects."""
5+
6+
try:
7+
from ._version import version as __version__ # noqa
8+
from ._version import version_tuple as __version_tuple__ # noqa
9+
except ImportError:
10+
__version__ = "0.0.0"
11+
__version_tuple__ = (0, 0, 0)

0 commit comments

Comments
 (0)