Skip to content

fix: derive __version__ from package metadata#81

Merged
joy-software merged 1 commit into
developfrom
fix/version-from-metadata
Jun 8, 2026
Merged

fix: derive __version__ from package metadata#81
joy-software merged 1 commit into
developfrom
fix/version-from-metadata

Conversation

@joy-software

Copy link
Copy Markdown
Contributor

codegraph/__init__.py hardcoded __version__ separately from pyproject.toml. The 0.5.0 bump only touched pyproject (and the release workflow only verifies the tag against pyproject), so published 0.5.0 self-reports as 0.4.6 in its cgh --version / banner.

Fix: read the version from importlib.metadata.version("cgh") so pyproject.toml is the single source of truth and the two can never drift again. Falls back to 0.0.0+source when run from a tree with no installed metadata.

Verified: uv run python -c "import codegraph; print(codegraph.__version__)" -> 0.5.0. This needs a patch release (0.5.1) to correct the banner on PyPI.

codegraph/__init__.py hardcoded __version__ separately from pyproject.toml,
so the 0.5.0 release shipped with a 0.4.6 banner (only pyproject was bumped,
and the release workflow checks the tag against pyproject only). Read the
version from importlib.metadata so pyproject.toml is the single source of
truth and the two can never drift again; fall back to a source sentinel when
no installed metadata is present.
@joy-software joy-software merged commit fdcdd7b into develop Jun 8, 2026
8 checks passed
@joy-software joy-software deleted the fix/version-from-metadata branch June 8, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant