From e4ff939ef5f6d610b4ed405efb55a3c63ad77c2b Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 2 Dec 2025 08:56:39 +0100 Subject: [PATCH] fix: DeprecationWarning * jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need. * resolved by copy pasting code to jsonresolver and using it from there --- datacite/jsonutils.py | 5 +++-- setup.cfg | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/datacite/jsonutils.py b/datacite/jsonutils.py index f0ed7d6..f930fae 100644 --- a/datacite/jsonutils.py +++ b/datacite/jsonutils.py @@ -3,6 +3,7 @@ # This file is part of DataCite. # # Copyright (C) 2016 CERN. +# Copyright (C) 2025 Graz University of Technology. # # DataCite is free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for @@ -12,7 +13,7 @@ import json -from jsonschema import RefResolver, validate +from jsonresolver.contrib.jsonschema import RefResolverBase from jsonschema.validators import validator_for @@ -25,5 +26,5 @@ def validator_factory(schema_filename): validator_cls.check_schema(schema) return validator_cls( - schema, resolver=RefResolver("file:{}".format(schema_filename), schema) + schema, resolver=RefResolverBase("file:{}".format(schema_filename), schema) ) diff --git a/setup.cfg b/setup.cfg index bb99ade..f916e41 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,7 @@ # # Copyright (C) 2015, 2016 CERN. # Copyright (C) 2024, California Institute of Technology +# Copyright (C) 2026 Graz University of Technology. # # DataCite is free software; you can redistribute it and/or modify it # under the terms of the Revised BSD License; see LICENSE file for @@ -30,7 +31,8 @@ include_package_data = True packages = find: zip_safe = False python_requires = >=3.9 -install_requires = +install_requires = + jsonresolver>=0.5.0 jsonschema>=3.0.0 lxml>=4.5.2 requests>=2.12.2 @@ -42,7 +44,7 @@ tests = responses>=0.10.6 mock>=1.3.0 pytest-invenio>=1.4.0 - pytest-black-ng>=0.4.0 + pytest-black>=0.6.0 datacite[docs] docs = Sphinx>=4.5.0 all = datacite[tests]