Skip to content

Use importlib from stdlib (if possible) #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions jsonschema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
RefResolver,
validate,
)

import importlib_metadata
__version__ = importlib_metadata.version("jsonschema")
try:
from importlib import metadata
except ImportError: # for Python<3.8
import importlib_metadata as metadata
__version__ = metadata.version("jsonschema")
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ packages = find:
setup_requires = setuptools_scm
install_requires =
attrs>=17.4.0
importlib_metadata
importlib_metadata;python_version<'3.8'
pyrsistent>=0.14.0
setuptools
six>=1.11.0
Expand Down