Skip to content

Commit

Permalink
📦 use setuptools_scm to generate version dynamically.
Browse files Browse the repository at this point in the history
  • Loading branch information
perillaroc committed Apr 8, 2024
1 parent 192232a commit a69287d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -11,7 +11,7 @@ description = "A data preparation tool for CEMC/CMA."
readme = "README.md"
keywords = ["data", "grib2", "cemc"]
license = {file = "LICENSE"}
version = "2023.05.1"
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",

Expand All @@ -28,7 +28,6 @@ dependencies = [
"numpy",
"pandas",
"xarray",
"eccodes",
"click",
"tqdm",
'importlib-metadata; python_version<"3.8"',
Expand All @@ -40,8 +39,8 @@ Documentation = "https://reki.readthedocs.io"
Repository = "https://github.com/cemc-oper/reki.git"

[project.optional-dependencies]
cfgrib = ["cfgrib"]
gdata = ["protobuf", "requests"]
grib2 = ["cfgrib", "eccodes"]
godas = ["protobuf", "requests"]
test = ["pytest"]
cov = ["pytest-cov", "codecov"]

Expand All @@ -52,3 +51,6 @@ namespaces = false

[tool.setuptools]
include-package-data = true

[tool.setuptools_scm]
version_file = "reki/_version.py"
8 changes: 7 additions & 1 deletion reki/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
__version__ = "2023.05.1"
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("package-name")
except PackageNotFoundError:
# package is not installed
pass

0 comments on commit a69287d

Please sign in to comment.