Skip to content

Commit fb352cf

Browse files
dcherianandersy005
andauthored
Add __version__ (#208)
Co-authored-by: Anderson Banihirwe <[email protected]>
1 parent be8b23e commit fb352cf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cf_xarray/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
from pkg_resources import DistributionNotFound, get_distribution
2+
13
from .accessor import CFAccessor # noqa
24
from .helpers import bounds_to_vertices, vertices_to_bounds # noqa
5+
6+
try:
7+
__version__ = get_distribution("cf_xarray").version
8+
except DistributionNotFound:
9+
# package is not installed
10+
__version__ = 'unknown'

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ skip_gitignore = true
4141
force_to_top = true
4242
default_section = THIRDPARTY
4343
known_first_party = cf_xarray
44-
known_third_party = dask,matplotlib,numpy,pandas,pytest,setuptools,sphinx_autosummary_accessors,xarray
44+
known_third_party = dask,matplotlib,numpy,pandas,pkg_resources,pytest,setuptools,sphinx_autosummary_accessors,xarray
4545

4646
# Most of the numerical computing stack doesn't have type annotations yet.
4747
[mypy-affine.*]

0 commit comments

Comments
 (0)