diff --git a/.gitignore b/.gitignore index 3e3600b..10e8b8b 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,5 @@ dmypy.json # Cython debug symbols cython_debug/ + +_version.py diff --git a/VERSION b/VERSION deleted file mode 100644 index d917d3e..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.2 diff --git a/ci/build_python.sh b/ci/build_python.sh index e8c33a8..92442ad 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -7,7 +7,10 @@ source rapids-date-string rapids-print-env -RAPIDS_PACKAGE_VERSION=$(head -1 ./VERSION) +rapids-mamba-retry install \ + --yes \ + 'hatchling' 'hatch-vcs' +RAPIDS_PACKAGE_VERSION=$(hatchling version) export RAPIDS_PACKAGE_VERSION # populates `RATTLER_CHANNELS` array and `RATTLER_ARGS` array diff --git a/conda/recipes/rapids-cli/recipe.yaml b/conda/recipes/rapids-cli/recipe.yaml index 0bf5ff3..1207a5e 100644 --- a/conda/recipes/rapids-cli/recipe.yaml +++ b/conda/recipes/rapids-cli/recipe.yaml @@ -27,7 +27,8 @@ requirements: host: - python - pip - - setuptools >=77.0.0 + - hatchling + - hatch-vcs run: - python - importlib-metadata >=4.13.0 diff --git a/pyproject.toml b/pyproject.toml index 0649f80..c088411 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,3 @@ -[build-system] -requires = [ - "setuptools>=77.0.0", - "wheel", -] -build-backend = "setuptools.build_meta" - [project] name = "rapids-cli" description = "A CLI for RAPIDS" @@ -40,8 +33,15 @@ nvlink_status = "rapids_cli.doctor.checks.nvlink:check_nvlink_status" Homepage = "https://github.com/rapidsai/rapids-cli" Source = "https://github.com/rapidsai/rapids-cli" -[tool.setuptools.dynamic] -version = {file = "VERSION"} +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.build.hooks.vcs] +version-file = "rapids_cli/_version.py" + +[tool.hatch.version] +source = "vcs" [tool.setuptools.packages.find] include = [ diff --git a/rapids_cli/__init__.py b/rapids_cli/__init__.py index 5549313..d6c0f30 100644 --- a/rapids_cli/__init__.py +++ b/rapids_cli/__init__.py @@ -2,3 +2,10 @@ # All rights reserved. # SPDX-License-Identifier: Apache-2.0 """RAPIDS CLI is a command-line interface for managing RAPIDS projects.""" + +try: + from ._version import version as __version__ # noqa + from ._version import version_tuple as __version_tuple__ # noqa +except ImportError: + __version__ = "0.0.0" + __version_tuple__ = (0, 0, 0)