Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use importlib.resources instead of pkg_resources
From the setuptools website [1]:

Use of pkg_resources is discouraged in favor of importlib.resources,
importlib.metadata, and their backports (importlib_resources,
importlib_metadata). Please consider using those libraries instead of
pkg_resources.

[1]: https://setuptools.pypa.io/en/latest/pkg_resources.html

Signed-off-by: Sam Van Den Berge <[email protected]>
  • Loading branch information
S4mw1s3 committed Aug 2, 2022
commit cc3280eb7618871194dc16fa2f24a7f6697a9aaa
4 changes: 2 additions & 2 deletions jsonrpcserver/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import json

from jsonschema.validators import validator_for # type: ignore
from pkg_resources import resource_string
import importlib.resources

from .dispatcher import dispatch_to_response_pure, Deserialized
from .methods import Methods, global_methods
Expand All @@ -26,7 +26,7 @@

# Prepare the jsonschema validator. This is global so it loads only once, not every
# time dispatch is called.
schema = json.loads(resource_string(__name__, "request-schema.json"))
schema = json.loads(importlib.resources.read_text(__package__, "request-schema.json"))
klass = validator_for(schema)
klass.check_schema(schema)
default_validator = klass(schema).validate
Expand Down