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
9 changes: 8 additions & 1 deletion codegraph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""codegraph — language-agnostic code graph for analysis, PR review, and AI assistants."""
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
from importlib.metadata import version as _version

__version__ = "0.0.1"
try:
__version__ = _version("polycodegraph")
except _PackageNotFoundError:
# Source checkout without install (rare — `pip install -e .` registers
# the package and avoids this branch in normal dev setups).
__version__ = "0.0.0+local"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "polycodegraph"
version = "0.1.0rc1"
version = "0.1.0rc2"
description = "Multi-language code graph builder, analyzer, PR risk reviewer, and MCP server. Supports Python, TypeScript, JavaScript, and Go."
readme = "README.md"
license = { text = "MIT" }
Expand Down
12 changes: 12 additions & 0 deletions tests/test_cli_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def test_version_flag() -> None:
assert __version__ in result.stdout


def test_version_matches_package_metadata() -> None:
"""Regression: __version__ must auto-sync with pyproject via importlib.metadata.

Catches the failure mode where someone re-hardcodes the version string and
it drifts from the actual published wheel — which is exactly what bit us
pre-0.1.0rc2 (codegraph.__version__ was "0.0.1" while the published wheel
was "0.1.0rc1").
"""
from importlib.metadata import version as _pkg_version
assert __version__ == _pkg_version("polycodegraph")


def test_help_lists_subcommands() -> None:
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0
Expand Down
Loading