diff --git a/pyproject.toml b/pyproject.toml index 1964ac8..36796bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ python = "^3.7.0" # Compatible python versions must be declared here rdflib = ">=6.1.1,<8" owlrl = ">=6.0.2,<7" prettytable = "^2.2.1" +packaging = ">=21.3" rdflib-jsonld = { version=">=0.4.0,<0.6", optional=true} pyduktape2 = {version="^0.4.1", optional=true} flake8 = {version="^3.8.0", optional=true} diff --git a/pyshacl/monkey/__init__.py b/pyshacl/monkey/__init__.py index 72242aa..dc254ef 100644 --- a/pyshacl/monkey/__init__.py +++ b/pyshacl/monkey/__init__.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -from distutils.version import LooseVersion +from packaging.version import Version import rdflib from rdflib import plugin, store -RDFLIB_VERSION = LooseVersion(rdflib.__version__) -RDFLIB_421 = LooseVersion("4.2.1") -RDFLIB_500 = LooseVersion("5.0.0") -RDFLIB_600 = LooseVersion("6.0.0") -RDFLIB_602 = LooseVersion("6.0.2") +RDFLIB_VERSION = Version(rdflib.__version__) +RDFLIB_421 = Version("4.2.1") +RDFLIB_500 = Version("5.0.0") +RDFLIB_600 = Version("6.0.0") +RDFLIB_602 = Version("6.0.2") def rdflib_bool_patch(): diff --git a/test/issues/test_146.py b/test/issues/test_146.py new file mode 100644 index 0000000..d14f630 --- /dev/null +++ b/test/issues/test_146.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" +https://github.com/RDFLib/pySHACL/issues/146 +""" + +import warnings + + +def test_146() -> None: + # Ensure that importing pyshacl triggers no warnings. + with warnings.catch_warnings(record=True) as warning_context: + # Cause all warnings to always be triggered. + warnings.simplefilter("always") + # Import pyshacl, which should not trigger any warnings + import pyshacl + # Verify some things + assert len(warning_context) == 0 + + +if __name__ == "__main__": + test_146()