Skip to content

Commit bff922d

Browse files
authored
Use setuptools-scm for packge version handling (#427)
1 parent 491e741 commit bff922d

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ build
2222

2323
# Documentation
2424
docs/build/
25+
26+
# setuptools-scm
27+
xskillscore/_version.py

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Internal Changes
1818
:py:func:`warnings.filterwarnings`. (:pr:`426`) `Trevor James Smith`_
1919
- The minimum supported versions for several dependencies have been
2020
updated. (:pr:`426`) `Trevor James Smith`_
21+
- `xskillscore` now uses `setuptools-scm` to automatically determine the
22+
version number. (:pr:`427`) `Trevor James Smith`_
2123

2224

2325
xskillscore v0.0.26 (2024-03-10)

docs/source/contributors.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Contributors
88
* mcsitter (`github <https://github.com/mcsitter/>`__)
99
* Ray Bell (`github <https://github.com/raybellwaves/>`__
1010
* Riley X. Brady (`github <https://github.com/bradyrx/>`__)
11+
* Trevor James Smith (`github <https://github.com/Zeitsperre/>`__)
1112
* Zachary Blackwood (`github <https://github.com/blackary/>`__)
1213

1314
For a list of all the contributions, see the github

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[build-system]
2-
requires = ["setuptools", "setuptools-scm"]
2+
requires = ["setuptools>=64", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "xskillscore"
7-
version = "0.0.26"
87
dependencies = [
98
"dask[array] >=2023.4.0",
109
"numpy >=1.24",
@@ -33,15 +32,14 @@ classifiers = [
3332
]
3433
requires-python = ">=3.9"
3534
license = {file = "LICENSE.txt"}
36-
dynamic = ["readme"]
35+
dynamic = ["readme", "version"]
3736

3837
[project.optional-dependencies]
39-
accel = ["bottleneck", "numba>=0.52"]
38+
accel = ["bottleneck", "numba >=0.57"]
4039
test = [
41-
"bottleneck",
40+
"xskillscore[accel]",
4241
"cftime",
4342
"matplotlib",
44-
"numba >=0.57",
4543
"pre-commit",
4644
"pytest",
4745
"pytest-cov",
@@ -73,6 +71,7 @@ packages = ["xskillscore"]
7371

7472
[tool.setuptools_scm]
7573
fallback_version = "9999"
74+
version_file = "xskillscore/_version.py"
7675

7776
[tool.setuptools.dynamic]
7877
readme = {file = ["README.rst"], content-type = "text/markdown"}

xskillscore/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from importlib.metadata import version, PackageNotFoundError
2+
13
# ruff: noqa
24
from xskillscore.core import resampling
35
from xskillscore.core.accessor import XSkillScoreAccessor
@@ -37,4 +39,8 @@
3739
from xskillscore.core.stattests import multipletests
3840
from xskillscore.versioning.print_versions import show_versions
3941

40-
__version__ = "0.0.26"
42+
try:
43+
__version__ = version("xskillscore")
44+
except PackageNotFoundError:
45+
# package is not installed
46+
pass

0 commit comments

Comments
 (0)