diff --git a/kopf/_cogs/helpers/versions.py b/kopf/_cogs/helpers/versions.py index bd7e895f..aad7a3a6 100644 --- a/kopf/_cogs/helpers/versions.py +++ b/kopf/_cogs/helpers/versions.py @@ -13,13 +13,12 @@ version: Optional[str] = None try: - import pkg_resources + import importlib.metadata except ImportError: pass else: try: name, *_ = __name__.split('.') # usually "kopf", unless renamed/forked. - dist: pkg_resources.Distribution = pkg_resources.get_distribution(name) - version = dist.version + version = importlib.metadata.version(name) except Exception: pass # installed as an egg, from git, etc.