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 urllib.parse import urljoin, urlparse
from zoneinfo import ZoneInfo
import requests
from bs4 import BeautifulSoup
from celery import chain
from celery.exceptions import MaxRetriesExceededError
from django.conf import settings
@@ -764,6 +763,8 @@ def render_mail(template, context, placeholder_mode=SafeFormatter.MODE_RICH_TO_P
def replace_images_with_cid_paths(body_html):
from bs4 import BeautifulSoup
if body_html:
email = BeautifulSoup(body_html, "lxml")
cid_images = []