Version drift: __init__.py hardcodes 0.18.0 but pyproject.toml declares 0.20.0 #61

Closed
opened 2026-05-20 20:46:24 -07:00 by xenon · 1 comment
Member

Problem

circuitforge_core/__init__.py hardcodes __version__ = "0.18.0" but pyproject.toml declares version = "0.20.0".

This means:

  • pip show circuitforge-core0.20.0 (reads pyproject)
  • circuitforge_core.__version__0.18.0 (reads hardcoded string)
  • Any product code or health-check endpoint that reports the core version via circuitforge_core.__version__ will be wrong

Fix

Switch to dynamic version resolution via importlib.metadata:

# circuitforge_core/__init__.py
from importlib.metadata import version, PackageNotFoundError
try:
    __version__ = version("circuitforge-core")
except PackageNotFoundError:
    __version__ = "dev"  # running from source without install

This is a single source of truth — pyproject.toml owns the version, __version__ always matches what pip installed.

Notes

  • PackageNotFoundError fallback handles running directly from a git clone without editable install
  • Discovered during xanderland.tv beta environment validation (2026-05-21)
## Problem `circuitforge_core/__init__.py` hardcodes `__version__ = "0.18.0"` but `pyproject.toml` declares `version = "0.20.0"`. This means: - `pip show circuitforge-core` → `0.20.0` (reads pyproject) - `circuitforge_core.__version__` → `0.18.0` (reads hardcoded string) - Any product code or health-check endpoint that reports the core version via `circuitforge_core.__version__` will be wrong ## Fix Switch to dynamic version resolution via `importlib.metadata`: ```python # circuitforge_core/__init__.py from importlib.metadata import version, PackageNotFoundError try: __version__ = version("circuitforge-core") except PackageNotFoundError: __version__ = "dev" # running from source without install ``` This is a single source of truth — pyproject.toml owns the version, `__version__` always matches what pip installed. ## Notes - `PackageNotFoundError` fallback handles running directly from a git clone without editable install - Discovered during xanderland.tv beta environment validation (2026-05-21)
Owner

Fixed in circuitforge_core/__init__.py — replaced hardcoded __version__ = "0.18.0" with importlib.metadata.version("circuitforge-core") (fallback to "dev" when not installed). Re-ran pip install -e . to refresh egg-info; now reads 0.21.0 correctly.

Fixed in `circuitforge_core/__init__.py` — replaced hardcoded `__version__ = "0.18.0"` with `importlib.metadata.version("circuitforge-core")` (fallback to `"dev"` when not installed). Re-ran `pip install -e .` to refresh egg-info; now reads `0.21.0` correctly.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/circuitforge-core#61
No description provided.