diff --git a/setup.py b/setup.py index e42d400..f0149eb 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,11 @@ def read(*names): "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", "Intended Audience :: Developers", diff --git a/src/stopit/__init__.py b/src/stopit/__init__.py index 6ca0180..c75e5e3 100644 --- a/src/stopit/__init__.py +++ b/src/stopit/__init__.py @@ -7,18 +7,21 @@ Public resources from ``stopit`` """ -import pkg_resources - from .utils import LOG, TimeoutException from .threadstop import ThreadingTimeout, async_raise, threading_timeoutable from .signalstop import SignalTimeout, signal_timeoutable # PEP 396 style version marker try: - __version__ = pkg_resources.get_distribution(__name__).version + from importlib.metadata import version # Python >=3.8 + __version__ = version(__name__) except: - LOG.warning("Could not get the package version from pkg_resources") - __version__ = 'unknown' + try: + import pkg_resources # Deprecated in recent setuptools + __version__ = pkg_resources.get_distribution(__name__).version + except: + LOG.warning("Could not get the package version from importlib or pkg_resources") + __version__ = 'unknown' __all__ = ( 'ThreadingTimeout', 'async_raise', 'threading_timeoutable',