Skip to content

Commit

Permalink
switch from pkg_resources to importlib for version provision (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo authored Dec 4, 2023
1 parent e75dad4 commit 7eec9a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions PyMPDATA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
![](https://github.com/atmos-cloud-sim-uj/PyMPDATA/releases/download/tip/readme_grid.png)
"""
# pylint: disable=invalid-name
from pkg_resources import DistributionNotFound, VersionConflict, get_distribution
from importlib.metadata import PackageNotFoundError, version

from .options import Options
from .scalar_field import ScalarField
Expand All @@ -17,7 +17,7 @@
from .vector_field import VectorField

try:
__version__ = get_distribution(__name__).version
except (DistributionNotFound, VersionConflict):
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass
6 changes: 3 additions & 3 deletions examples/PyMPDATA_examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
PyMPDATA_examples package includes common Python modules used in PyMPDATA smoke tests
and in example notebooks (but the package wheels do not include the notebooks)
"""
from pkg_resources import DistributionNotFound, VersionConflict, get_distribution
from importlib.metadata import PackageNotFoundError, version

try:
__version__ = get_distribution(__name__).version
except (DistributionNotFound, VersionConflict):
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass

0 comments on commit 7eec9a7

Please sign in to comment.