From eef4c82adf1514c8da4d60677076e6650203373b Mon Sep 17 00:00:00 2001 From: Kevin Klein <7267523+kklein@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:25:30 +0200 Subject: [PATCH] Remove deprecated pkg_resources. (#231) --- src/datajudge/__init__.py | 4 ++-- src/datajudge/pytest_integration.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datajudge/__init__.py b/src/datajudge/__init__.py index 546a1198..5d404f53 100644 --- a/src/datajudge/__init__.py +++ b/src/datajudge/__init__.py @@ -1,7 +1,7 @@ """datajudge allows to assess whether data from database complies with reference information.""" -import pkg_resources +import importlib.metadata from .constraints.base import Constraint from .db_access import Condition @@ -16,6 +16,6 @@ ] try: - __version__ = pkg_resources.get_distribution(__name__).version + __version__ = importlib.metadata.distribution(__name__).version except Exception: __version__ = "1.8.0" diff --git a/src/datajudge/pytest_integration.py b/src/datajudge/pytest_integration.py index c6cf6c02..dabb0526 100644 --- a/src/datajudge/pytest_integration.py +++ b/src/datajudge/pytest_integration.py @@ -1,7 +1,7 @@ from typing import Iterable import pytest -from pkg_resources import parse_version +from packaging.version import Version from .constraints.base import Constraint from .db_access import apply_patches @@ -22,7 +22,7 @@ def get_formatter(pytestconfig): try: import pytest_html - if parse_version(pytest_html.__version__).major >= 4: + if Version(pytest_html.__version__).major >= 4: return AnsiColorFormatter() finally: return Formatter()