fix: lazy imports for matplotlib & gdstk (#161)

only require matplotlib & gdstk for functionality where we actually use them

contributed by @gerardvt
This commit is contained in:
Gerard Talatinian
2026-03-26 11:02:37 +01:00
committed by GitHub
parent 4c1ebdd9c0
commit bd4a4a08e5
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -5,7 +5,6 @@ import subprocess
from typing import Optional
import chevron
import matplotlib as mpl
from config import Config, DatasheetConfig
@@ -29,6 +28,8 @@ class DocsHelper:
"""
Format the clock with engineering notation
"""
import matplotlib as mpl
if clock == 0:
return "No Clock"
else:
+2 -1
View File
@@ -5,7 +5,6 @@ import re
import subprocess
import cairosvg # type: ignore
import gdstk # type: ignore
# Custom exception for convert_svg_to_png()
@@ -35,6 +34,8 @@ def render_svg(
filter_layers=None,
scramble_cells=None,
):
import gdstk # type: ignore
library = gdstk.read_gds(gds)
top_cells = library.top_level()
assert len(top_cells) == 1