Skip to content

Commit 7ce0ef8

Browse files
Replace pkg_resources with importlib_resources (#562)
Co-authored-by: Peter Doggart <[email protected]>
1 parent 289de36 commit 7ce0ef8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

flask_restx/schemas/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"""
77
import io
88
import json
9-
import pkg_resources
9+
10+
import importlib_resources
1011

1112
from collections.abc import Mapping
1213
from jsonschema import Draft4Validator
@@ -56,8 +57,9 @@ def __init__(self, filename, validator=Draft4Validator):
5657

5758
def _load(self):
5859
if not self._schema:
59-
filename = pkg_resources.resource_filename(__name__, self.filename)
60-
with io.open(filename) as infile:
60+
ref = importlib_resources.files(__name__) / self.filename
61+
62+
with io.open(ref) as infile:
6163
self._schema = json.load(infile)
6264

6365
def __getitem__(self, key):

requirements/install.pip

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ jsonschema
33
Flask>=0.8, !=2.0.0
44
werkzeug !=2.0.0
55
pytz
6+
importlib_resources

0 commit comments

Comments
 (0)