diff --git a/PyMPDATA/__init__.py b/PyMPDATA/__init__.py index b07bfd4e..afb58b25 100644 --- a/PyMPDATA/__init__.py +++ b/PyMPDATA/__init__.py @@ -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 @@ -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 diff --git a/examples/PyMPDATA_examples/__init__.py b/examples/PyMPDATA_examples/__init__.py index ddbc0c79..9dca3049 100644 --- a/examples/PyMPDATA_examples/__init__.py +++ b/examples/PyMPDATA_examples/__init__.py @@ -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