diff --git a/CHANGELOG.md b/CHANGELOG.md index f37c623..2c1b480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Keep it human-readable, your future self will thank you! ## [Unreleased](https://github.com/ecmwf/anemoi-utils/compare/0.4.0...HEAD) +## Fixed +- Fix `__version__` import in init + ### Changed - Fix pre-commit regex diff --git a/src/anemoi/utils/__init__.py b/src/anemoi/utils/__init__.py index eef2c1d..9733be2 100644 --- a/src/anemoi/utils/__init__.py +++ b/src/anemoi/utils/__init__.py @@ -6,4 +6,10 @@ # nor does it submit to any jurisdiction. -from ._version import __version__ as __version__ +try: + # NOTE: the `_version.py` file must not be present in the git repository + # as it is generated by setuptools at install time + from ._version import __version__ # type: ignore +except ImportError: # pragma: no cover + # Local copy or not installed with setuptools + __version__ = "999"