Skip to content

Commit

Permalink
add __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
dougiesquire committed Apr 16, 2024
1 parent 819204c commit 469ecfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions esmgrids/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("esmgrids")
except PackageNotFoundError:
# package is not installed
pass
4 changes: 3 additions & 1 deletion esmgrids/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import argparse

from esmgrids import __version__
from esmgrids.util import md5sum
from esmgrids.mom_grid import MomGrid
from esmgrids.cice_grid import CiceGrid
Expand All @@ -24,7 +25,8 @@ def cice_from_mom():

# to-do: need to input package version here
runcmd = (
f"Created using esmgrid: cice_from_mom --ocean_hgrid={ocean_hgrid} --ocean_mask={ocean_mask} "
f"Created using esmgrid {__version__}: "
f"cice_from_mom --ocean_hgrid={ocean_hgrid} --ocean_mask={ocean_mask} "
f"--cice_grid={cice_grid} --cice_kmt={cice_kmt}"
)
provenance_metadata = {
Expand Down

0 comments on commit 469ecfc

Please sign in to comment.