diff --git a/.gitignore b/.gitignore index f3f3ebd3..d8f72e09 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ build # Documentation docs/build/ + +# setuptools-scm +xskillscore/_version.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 08dc3687..8bdf55fd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,8 @@ Internal Changes :py:func:`warnings.filterwarnings`. (:pr:`426`) `Trevor James Smith`_ - The minimum supported versions for several dependencies have been updated. (:pr:`426`) `Trevor James Smith`_ +- `xskillscore` now uses `setuptools-scm` to automatically determine the + version number. (:pr:`427`) `Trevor James Smith`_ xskillscore v0.0.26 (2024-03-10) diff --git a/docs/source/contributors.rst b/docs/source/contributors.rst index 5ded3539..b3c2237e 100644 --- a/docs/source/contributors.rst +++ b/docs/source/contributors.rst @@ -8,6 +8,7 @@ Contributors * mcsitter (`github `__) * Ray Bell (`github `__ * Riley X. Brady (`github `__) +* Trevor James Smith (`github `__) * Zachary Blackwood (`github `__) For a list of all the contributions, see the github diff --git a/pyproject.toml b/pyproject.toml index 6061a3f5..a4ebfda2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,9 @@ [build-system] -requires = ["setuptools", "setuptools-scm"] +requires = ["setuptools>=64", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" [project] name = "xskillscore" -version = "0.0.26" dependencies = [ "dask[array] >=2023.4.0", "numpy >=1.24", @@ -33,15 +32,14 @@ classifiers = [ ] requires-python = ">=3.9" license = {file = "LICENSE.txt"} -dynamic = ["readme"] +dynamic = ["readme", "version"] [project.optional-dependencies] -accel = ["bottleneck", "numba>=0.52"] +accel = ["bottleneck", "numba >=0.57"] test = [ - "bottleneck", + "xskillscore[accel]", "cftime", "matplotlib", - "numba >=0.57", "pre-commit", "pytest", "pytest-cov", @@ -73,6 +71,7 @@ packages = ["xskillscore"] [tool.setuptools_scm] fallback_version = "9999" +version_file = "xskillscore/_version.py" [tool.setuptools.dynamic] readme = {file = ["README.rst"], content-type = "text/markdown"} diff --git a/xskillscore/__init__.py b/xskillscore/__init__.py index 1e64730c..d51f7855 100644 --- a/xskillscore/__init__.py +++ b/xskillscore/__init__.py @@ -1,3 +1,5 @@ +from importlib.metadata import version, PackageNotFoundError + # ruff: noqa from xskillscore.core import resampling from xskillscore.core.accessor import XSkillScoreAccessor @@ -37,4 +39,8 @@ from xskillscore.core.stattests import multipletests from xskillscore.versioning.print_versions import show_versions -__version__ = "0.0.26" +try: + __version__ = version("xskillscore") +except PackageNotFoundError: + # package is not installed + pass