diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..51862c2 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/conf.py + +python: + install: + - method: pip + path: . + system_packages: true diff --git a/screed/__init__.py b/screed/__init__.py index 5f0861f..70c4558 100755 --- a/screed/__init__.py +++ b/screed/__init__.py @@ -36,10 +36,10 @@ from screed.screedRecord import Record -from pkg_resources import get_distribution, DistributionNotFound +from importlib.metadata import version, PackageNotFoundError try: - VERSION = get_distribution(__name__).version -except DistributionNotFound: # pragma: no cover + VERSION = version(__name__) +except PackageNotFoundError: # pragma: no cover try: from .version import version as VERSION # noqa except ImportError: # pragma: no cover diff --git a/screed/tests/screed_tst_utils.py b/screed/tests/screed_tst_utils.py index ec3d4a6..ab99b8c 100644 --- a/screed/tests/screed_tst_utils.py +++ b/screed/tests/screed_tst_utils.py @@ -11,20 +11,20 @@ import tempfile import os import shutil -from pkg_resources import Requirement, resource_filename, ResolutionError from io import StringIO import sys import traceback +from importlib import resources + +# Remove when we drop support for 3.8 +if sys.version_info < (3, 9): + import importlib_resources as resources + def get_test_data(filename): - filepath = None - try: - filepath = resource_filename( - Requirement.parse("screed"), "screed/tests/" + filename) - except ResolutionError: - pass - if not filepath or not os.path.isfile(filepath): + filepath = resources.files('screed') / 'screed' / 'tests' / filename + if not filepath.exists() or not os.path.isfile(filepath): filepath = os.path.join(os.path.dirname(__file__), 'test-data', filename) return filepath diff --git a/setup.cfg b/setup.cfg index 328a24d..f7cc503 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,5 +50,6 @@ test = pytest >= 6.2.2 pycodestyle pytest-cov + importlib_resources;python_version<'3.9' all = %(test)s diff --git a/tox.ini b/tox.ini index 71edf75..4581f8c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,8 @@ [tox] envlist = py38, py39, py310 +minversion = 3.12 +isolated_build = true +skip_missing_interpreters = true [testenv] passenv =