diff --git a/HISTORY.rst b/HISTORY.rst index dca729789d..b7d0b077ae 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -55,6 +55,9 @@ Unreleased Changes * Removed the ``utils`` functions ``array_equals_nodata``, ``exponential_decay_kernel_raster``, and ``gaussian_decay_kernel_raster``, which were obsoleted by new ``pygeoprocessing`` features. + * Version metadata at import time is now fetched with + ``importlib.metadata`` instead of ``pkg_resources``. + (`#1442 `_) * Pollination * Replaced custom kernel implementation with ``pygeoprocessing.kernels``. Convolution results may be slightly different (more accurate). diff --git a/src/natcap/invest/__init__.py b/src/natcap/invest/__init__.py index 1171e28ca1..3ecba007e0 100644 --- a/src/natcap/invest/__init__.py +++ b/src/natcap/invest/__init__.py @@ -1,19 +1,19 @@ """init module for natcap.invest.""" +import importlib.metadata import logging import os import sys from gettext import translation import babel -import pkg_resources LOGGER = logging.getLogger('natcap.invest') LOGGER.addHandler(logging.NullHandler()) __all__ = ['local_dir', ] try: - __version__ = pkg_resources.get_distribution(__name__).version -except pkg_resources.DistributionNotFound: + __version__ = importlib.metadata.version('natcap.invest') +except importlib.metadata.PackageNotFoundError: # package is not installed. Log the exception for debugging. LOGGER.exception('Could not load natcap.invest version information')