From 4e99390b3ac4da6fe6aa068b1c24d2dc36ef4f57 Mon Sep 17 00:00:00 2001
From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Date: Tue, 13 May 2025 13:08:41 -0400
Subject: [PATCH 1/5] ignore setuptools-scm-generated files
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
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
From 4a661a5f2307638db355af062f4e61d055d58513 Mon Sep 17 00:00:00 2001
From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Date: Tue, 13 May 2025 13:15:29 -0400
Subject: [PATCH 2/5] configure setuptools-scm for git-based version tracking
---
pyproject.toml | 6 +++---
xskillscore/__init__.py | 8 +++++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 6061a3f5..e0a29e85 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,7 +32,7 @@ classifiers = [
]
requires-python = ">=3.9"
license = {file = "LICENSE.txt"}
-dynamic = ["readme"]
+dynamic = ["readme", "version"]
[project.optional-dependencies]
accel = ["bottleneck", "numba>=0.52"]
@@ -73,6 +72,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
From 05b315b0598732ccc3eef706a2519c8162d0119b Mon Sep 17 00:00:00 2001
From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Date: Tue, 13 May 2025 13:15:52 -0400
Subject: [PATCH 3/5] simplify install recipes further
---
pyproject.toml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index e0a29e85..a4ebfda2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,12 +35,11 @@ license = {file = "LICENSE.txt"}
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",
From 319f36da68307fa53ac5b3c34685a90333b10437 Mon Sep 17 00:00:00 2001
From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Date: Tue, 13 May 2025 13:20:20 -0400
Subject: [PATCH 4/5] update contributors.rst
---
docs/source/contributors.rst | 1 +
1 file changed, 1 insertion(+)
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
From fa5883bf4527e6259622f8c09bc78429c012af39 Mon Sep 17 00:00:00 2001
From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Date: Tue, 13 May 2025 13:32:57 -0400
Subject: [PATCH 5/5] update CHANGELOG.rst
---
CHANGELOG.rst | 2 ++
1 file changed, 2 insertions(+)
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)