Skip to content

Commit 30b44a9

Browse files
committed
fix: derive __version__ from package metadata
__version__ was hardcoded to 0.1.0 and never bumped (it isn't in release-please's extra-files), so eia.__version__ misreported the installed version. Read it from importlib.metadata instead, with a source-checkout fallback.
1 parent 46885bc commit 30b44a9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/eia/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
A Python client for interacting with the U.S. Energy Information Administration (EIA) API.
55
"""
66

7+
from importlib.metadata import PackageNotFoundError, version as _version
8+
79
from .client import EIAClient, EIAError
810
from .cache import CacheConfig
911
from . import catalog
1012

11-
__version__ = "0.1.0"
13+
try:
14+
__version__ = _version("python-eia")
15+
except PackageNotFoundError: # not installed (e.g. running from a source checkout)
16+
__version__ = "0.0.0+unknown"
1217
__all__ = ["EIAClient", "EIAError", "CacheConfig", "catalog"]

0 commit comments

Comments
 (0)