Skip to content

Commit

Permalink
pyfabm: added __version__ attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jornbr committed Jan 3, 2024
1 parent ee3265f commit c7cdc93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/fabm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions src/pyfabm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
Sequence,
)

try:
import importlib.metadata

__version__ = importlib.metadata.version("pyfabm")
except ImportError:
pass

try:
import numpy as np
except ImportError:
Expand Down

0 comments on commit c7cdc93

Please sign in to comment.