diff --git a/.github/workflows/fabm.yml b/.github/workflows/fabm.yml index 7014c3d7..23eb7a36 100644 --- a/.github/workflows/fabm.yml +++ b/.github/workflows/fabm.yml @@ -227,7 +227,7 @@ jobs: run: python -m pip install . - name: Test run: | - python -c "import pyfabm" + python -c "import pyfabm;print('pyfabm version =', getattr(pyfabm, '__version__', None))" for f in testcases/*.yaml; do fabm_describe_model $f; done for f in testcases/*.yaml; do fabm_complete_yaml --add_missing $f; done fabm0d: diff --git a/src/pyfabm/__init__.py b/src/pyfabm/__init__.py index 73720aec..bc4d875d 100644 --- a/src/pyfabm/__init__.py +++ b/src/pyfabm/__init__.py @@ -15,6 +15,13 @@ Sequence, ) +try: + import importlib.metadata + + __version__ = importlib.metadata.version("pyfabm") +except ImportError: + pass + try: import numpy as np except ImportError: