Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating how we get version information from package metadata #1443

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/natcap/invest/issues/1442>`_)
* Pollination
* Replaced custom kernel implementation with ``pygeoprocessing.kernels``.
Convolution results may be slightly different (more accurate).
Expand Down
6 changes: 3 additions & 3 deletions src/natcap/invest/__init__.py
Original file line number Diff line number Diff line change
@@ -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')

Expand Down