-
Notifications
You must be signed in to change notification settings - Fork 244
Description
Description of the problem
Line 23 in 24600ee
| from pkg_resources import get_distribution |
In __init__.py, we use the get_distribution function from the pkg_resources module to get the version string of the PyGMT package.
It seems, pkg_resources is no longer recommended.
https://setuptools.pypa.io/en/latest/pkg_resources.html
Use of pkg_resources is discouraged in favor of importlib.resources, importlib.metadata, and their backports (resources, metadata). Please consider using those libraries instead of pkg_resources.
https://github.com/pypa/setuptools_scm#retrieving-package-version-at-runtime
Alternatively, you can use pkg_resources which is included in setuptools (but has a significant runtime cost):
I think we should use importlib.metadata instead:
from importlib.metadata import version
__version__ = version("pygmt")
The importlib.metadata module was added in Python 3.8, but PyGMT currently still supports Python 3.7. Luckily, we're going to drop Python 3.7 support on Dec. 26, 2021 as per NEP29, so it won't be a problem for us.