diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index b6cfa0ded..11332a1ea 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -71,6 +71,8 @@ # class-level _class_is_valid_at_instantiation attribute to False DEBUG_MODE: bool = True +jsonschema_version_str = importlib_version("jsonschema") + def enable_debug_mode() -> None: global DEBUG_MODE @@ -203,7 +205,6 @@ def _get_json_schema_draft_url(schema: dict) -> str: def _use_referencing_library() -> bool: """In version 4.18.0, the jsonschema package deprecated RefResolver in favor of the referencing library.""" - jsonschema_version_str = importlib_version("jsonschema") return Version(jsonschema_version_str) >= Version("4.18") diff --git a/tools/schemapi/schemapi.py b/tools/schemapi/schemapi.py index 52d58d1d3..829f477cf 100644 --- a/tools/schemapi/schemapi.py +++ b/tools/schemapi/schemapi.py @@ -69,6 +69,8 @@ # class-level _class_is_valid_at_instantiation attribute to False DEBUG_MODE: bool = True +jsonschema_version_str = importlib_version("jsonschema") + def enable_debug_mode() -> None: global DEBUG_MODE @@ -201,7 +203,6 @@ def _get_json_schema_draft_url(schema: dict) -> str: def _use_referencing_library() -> bool: """In version 4.18.0, the jsonschema package deprecated RefResolver in favor of the referencing library.""" - jsonschema_version_str = importlib_version("jsonschema") return Version(jsonschema_version_str) >= Version("4.18")