From 9b2d7a95bf44ffd30d60eb5015d61eec8a1f849c Mon Sep 17 00:00:00 2001 From: Elaine Hale Date: Fri, 8 May 2026 09:20:39 -0600 Subject: [PATCH] Move version into the package and make it more discoverable. --- pyproject.toml | 5 ++++- src/stride/__init__.py | 3 +++ src/stride/cli/stride.py | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4d89ed4..9cdf485 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "stride-load-forecast" -version = "2.0.0" +dynamic = ["version"] description = "Python tool for assembling annual hourly electricity demand projections suitable for grid planning at the country-level." readme = "README.md" requires-python = ">=3.11, <3.14" @@ -67,6 +67,9 @@ Source = "https://github.com/dsgrid/stride" [project.scripts] stride = "stride.cli.stride:cli" +[tool.hatch.version] +path = "src/stride/__init__.py" + [tool.hatch.build.targets.wheel] packages = ["src/stride"] diff --git a/src/stride/__init__.py b/src/stride/__init__.py index f7f6ff4..58d20b2 100644 --- a/src/stride/__init__.py +++ b/src/stride/__init__.py @@ -1,3 +1,5 @@ +__version__ = "2.0.0" + from stride.project import Project from stride.models import ( ProjectConfig, @@ -9,4 +11,5 @@ "Project", "ProjectConfig", "Scenario", + "__version__", ) diff --git a/src/stride/cli/stride.py b/src/stride/cli/stride.py index ea2aac6..b65a642 100644 --- a/src/stride/cli/stride.py +++ b/src/stride/cli/stride.py @@ -9,7 +9,7 @@ from dsgrid.exceptions import DSGBaseException from loguru import logger -from stride import Project +from stride import Project, __version__ from stride.config import CACHED_PROJECTS_UPPER_BOUND from stride.models import CalculatedTableOverride from stride.project import list_valid_countries, list_valid_model_years, list_valid_weather_years @@ -28,6 +28,7 @@ @click.group("stride") +@click.version_option(__version__, "-V", "--version", prog_name="stride") @click.option( "-c", "--console-level",