diff --git a/mikeio/__init__.py b/mikeio/__init__.py index c8d8d03f5..3c19e33b4 100644 --- a/mikeio/__init__.py +++ b/mikeio/__init__.py @@ -1,4 +1,5 @@ from __future__ import annotations +from importlib.metadata import PackageNotFoundError, version from pathlib import Path from platform import architecture from collections.abc import Sequence @@ -21,7 +22,14 @@ # 'X.Y.dev0' is the canonical version of 'X.Y.dev' # -__version__ = "2.2.dev2" # TODO use git hash instead for dev version? +try: + # read version from installed package + __version__ = version("mikeio") +except PackageNotFoundError: + # package is not installed + __version__ = "dev" + +# __version__ = "2.2.dev2" # TODO use git hash instead for dev version? # __version__ = "1.5.0" __dfs_version__: int = 220 diff --git a/pyproject.toml b/pyproject.toml index a81ed6145..e3e23fc21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ exclude = ["notebooks", "tests", "images", ".github", "docs", ".devcontainer", " [project] name="mikeio" -version="2.2.dev2" +version="2.1.3" dependencies = [ "mikecore>=0.2.1", "numpy>=1.22.0",