Skip to content

Commit 9bdf304

Browse files
vvillait88claude
andcommitted
fix: read __version__ from importlib.metadata (single source)
Hardcoding `__version__ = "1.0.0"` in `__init__.py` while pyproject.toml is at "1.0.1" creates a two-spot version drift. Read from `importlib.metadata` so pyproject.toml is the single source of truth (matches python-sdk's pattern). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent baedcc7 commit 9bdf304

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

agentscore_commerce/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@
99
agentscore_commerce.api - AgentScore SDK re-export
1010
"""
1111

12-
__version__ = "1.0.0"
12+
from importlib.metadata import PackageNotFoundError
13+
from importlib.metadata import version as _pkg_version
14+
15+
try:
16+
__version__ = _pkg_version("agentscore-commerce")
17+
except PackageNotFoundError:
18+
# Editable install or pre-build state — fall back to a sentinel so consumers
19+
# don't crash on a missing dist-info dir. Real version always comes from
20+
# pyproject.toml at install time.
21+
__version__ = "0.0.0+local"

0 commit comments

Comments
 (0)