Import large package lazily to speed up startup (#5636)

* Import large package lazily to speed up startup

* Make all jsonschema imports lazy
This commit is contained in:
Raphael Michel
2025-12-09 09:52:53 +01:00
committed by GitHub
parent f214edaf34
commit b895d9bbca
10 changed files with 41 additions and 11 deletions

View File

@@ -47,7 +47,6 @@ from collections import OrderedDict, defaultdict
from functools import partial
from io import BytesIO
import jsonschema
import pypdf
import pypdf.generic
import reportlab.rl_config
@@ -1311,6 +1310,8 @@ def _correct_page_media_box(page: pypdf.PageObject):
@deconstructible
class PdfLayoutValidator:
def __call__(self, value):
import jsonschema
if not isinstance(value, dict):
try:
val = json.loads(value)