Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
# this addition provided direct abbreviated link to the modules in the model
sys.path.insert(1, os.path.abspath('../../temoa/temoa_model'))

# Import version from source (after sys.path setup)
from temoa.__about__ import __version__

# -- Project information from pyproject.toml ---------------------------------

# Read version and metadata from pyproject.toml for single source of truth
# Read metadata from pyproject.toml
pyproject_path = Path(__file__).parent.parent.parent / 'pyproject.toml'
with open(pyproject_path) as f:
pyproject_data = tomlkit.load(f)
Expand All @@ -32,12 +34,11 @@
)
copyright = f'2011-{time.strftime("%Y")}, NC State University'

# The short X.Y version
version = cast('str', project_metadata['version']).rsplit('.', 1)[
0
] # '4.0.0a1.dev20251113' -> '4.0.0a1'
# The full version, including alpha/beta/rc tags
release = str(project_metadata['version'])

# The short version
version = __version__.rsplit('.', 1)[0]
# The full version
release = __version__


# -- General configuration ---------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "temoa"
version = "4.0.0a1.dev20251113"
dynamic = ["version"]
description = "Tools for Energy Model Optimization and Analysis"
readme = "README.md"
requires-python = ">=3.12"
Expand Down Expand Up @@ -78,6 +78,9 @@ include = [
package-data = { "temoa" = ["db_schema/*.sql", "tutorial_assets/*", "py.typed"] }


[tool.hatch.version]
path = "temoa/__about__.py"

[tool.ruff]
line-length = 100
indent-width = 4
Expand Down
24 changes: 24 additions & 0 deletions temoa/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import re

__version__ = '4.0.0a1.dev20251201'

# Parse the version string to get major and minor versions
# We use a regex to be robust against versions like "4.1a1" or "4.0.0.dev1"
_match = re.match(r'^(\d+)\.(\d+)', __version__)
if not _match:
raise ValueError(
f"Could not parse major/minor version from '{__version__}'. "
"Expected format 'X.Y...' where X and Y are integers."
)

TEMOA_MAJOR = int(_match.group(1))
TEMOA_MINOR = int(_match.group(2))

# === REQUIREMENTS ===
# python versions are tested internally for greater than these values
MIN_PYTHON_MAJOR = 3
MIN_PYTHON_MINOR = 12

# db is tested for match on major and >= on minor
DB_MAJOR_VERSION = 4
MIN_DB_MINOR_VERSION = 0
7 changes: 2 additions & 5 deletions temoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

# Core API - public interface
# Internal modules - for backward compatibility
# Version information
from temoa.__about__ import TEMOA_MAJOR, TEMOA_MINOR, __version__
from temoa._internal.data_brick import DataBrick, data_brick_factory
from temoa._internal.exchange_tech_cost_ledger import CostType, ExchangeTechCostLedger
from temoa._internal.run_actions import (
Expand All @@ -30,11 +32,6 @@
from temoa.core.modes import TemoaMode
from temoa.data_io.hybrid_loader import HybridLoader

# Version information
from temoa.version_information import TEMOA_MAJOR, TEMOA_MINOR

__version__ = '4.0.0a1'

# Maintain backward compatibility for common imports
__all__ = [
# Core API
Expand Down
12 changes: 6 additions & 6 deletions temoa/_internal/temoa_sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
from logging import getLogger
from typing import TYPE_CHECKING

from temoa.__about__ import (
DB_MAJOR_VERSION,
MIN_DB_MINOR_VERSION,
MIN_PYTHON_MAJOR,
MIN_PYTHON_MINOR,
)
from temoa._internal.run_actions import (
build_instance,
check_database_version,
Expand All @@ -28,12 +34,6 @@
from temoa.extensions.myopic.myopic_sequencer import MyopicSequencer
from temoa.extensions.single_vector_mga.sv_mga_sequencer import SvMgaSequencer
from temoa.model_checking.pricing_check import price_checker
from temoa.version_information import (
DB_MAJOR_VERSION,
MIN_DB_MINOR_VERSION,
MIN_PYTHON_MAJOR,
MIN_PYTHON_MINOR,
)

if TYPE_CHECKING:
import pyomo.opt
Expand Down
4 changes: 2 additions & 2 deletions temoa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from rich.logging import RichHandler
from rich.text import Text

from temoa.__about__ import __version__
from temoa._internal.temoa_sequencer import TemoaSequencer
from temoa.core.config import TemoaConfig
from temoa.core.modes import TemoaMode
from temoa.utilities import db_migration_v3_1_to_v4, sql_migration_v3_1_to_v4
from temoa.version_information import TEMOA_MAJOR, TEMOA_MINOR

# =============================================================================
# Logging & Helper Setup
Expand Down Expand Up @@ -103,7 +103,7 @@ def _setup_sequencer(
# =============================================================================
def _version_callback(value: bool) -> None:
if value:
version = f'{TEMOA_MAJOR}.{TEMOA_MINOR}'
version = __version__
rich.print(f'Temoa Version: [bold green]{version}[/bold green]')
raise typer.Exit()

Expand Down
13 changes: 0 additions & 13 deletions temoa/version_information.py

This file was deleted.

1 change: 0 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.