File flask-restx-importlib.patch of Package python-flask-restx
commit b61314fcae641ef56c9041551b31a9427bedd00f
Author: Steve Kowalik <steven@wedontsleep.org>
Date: Thu Apr 9 15:37:51 2026 +1000
Replace importlib_resources with stdlib
Now that Python 3.9 is the minimum version supported, we can switch
to using the stdlib importlib.resources, and drop one external
dependency.
diff --git a/flask_restx/schemas/__init__.py b/flask_restx/schemas/__init__.py
index 84e4db1..1ef21de 100644
--- a/flask_restx/schemas/__init__.py
+++ b/flask_restx/schemas/__init__.py
@@ -5,11 +5,10 @@ and allows to validate specs against them.
.. versionadded:: 0.12.1
"""
+import importlib.resources
import io
import json
-import importlib_resources
-
from collections.abc import Mapping
from jsonschema import Draft4Validator
@@ -58,7 +57,7 @@ class LazySchema(Mapping):
def _load(self):
if not self._schema:
- ref = importlib_resources.files(__name__) / self.filename
+ ref = importlib.resources.files(__name__) / self.filename
with io.open(ref) as infile:
self._schema = json.load(infile)
diff --git a/requirements/install.pip b/requirements/install.pip
index f24652b..6001624 100644
--- a/requirements/install.pip
+++ b/requirements/install.pip
@@ -3,4 +3,3 @@ jsonschema
referencing
Flask>=0.8, !=2.0.0
werkzeug!=2.0.0
-importlib_resources