diff --git a/docs/source/conf.py b/docs/source/conf.py index 9b571d0..3c7312a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,10 +24,8 @@ author = 'The Foreman' try: - import pkg_resources - package = pkg_resources.require("obsah")[0] - version = package.version - release = package.version + from importlib import metadata + version = release = metadata.version('obsah') except: # The short X.Y version version = '' diff --git a/obsah/__init__.py b/obsah/__init__.py index 8efd6eb..f2b690c 100755 --- a/obsah/__init__.py +++ b/obsah/__init__.py @@ -15,9 +15,9 @@ import sys from collections import namedtuple from functools import total_ordering +from importlib import resources import yaml -import pkg_resources try: import argcomplete @@ -207,12 +207,8 @@ def data_path(): """ path = os.environ.get('OBSAH_DATA') if path is None: - path = pkg_resources.resource_filename(__name__, 'data') - if not os.path.isabs(path): - # this is essentially a workaround for - # https://github.com/pytest-dev/pytest-xdist/issues/414 - distribution = pkg_resources.get_distribution('obsah') - path = os.path.join(distribution.location, path) + # TODO: deprecated in 3.11 + path = resources.path(__name__, 'data') return path