Skip to content

Commit 79e0bf9

Browse files
committed
logger lazy import
1 parent ba273df commit 79e0bf9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jupyter_sphinx/ast.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import ipywidgets.embed
1313
import nbconvert
1414

15-
import jupyter_sphinx as js
1615
from .utils import strip_latex_delimiters, sphinx_abs_dir
1716
from .thebelab import ThebeSourceNode, ThebeOutputNode
1817

@@ -77,6 +76,8 @@ class JupyterCell(Directive):
7776
}
7877

7978
def run(self):
79+
# This only works lazily because the logger is inited by Sphinx
80+
from . import logger
8081
location = self.state_machine.get_source_and_line(self.lineno)
8182

8283
if self.arguments:
@@ -85,7 +86,7 @@ def run(self):
8586
rel_filename, filename = env.relfn2path(self.arguments[0])
8687
env.note_dependency(rel_filename)
8788
if self.content:
88-
js.logger.warning(
89+
logger.warning(
8990
'Ignoring inline code in Jupyter cell included from "{}"'.format(
9091
rel_filename
9192
),
@@ -108,7 +109,7 @@ def run(self):
108109
nlines = len(content)
109110
hl_lines = parselinenos(emphasize_linespec, nlines)
110111
if any(i >= nlines for i in hl_lines):
111-
js.logger.warning(
112+
logger.warning(
112113
"Line number spec is out of range(1-{}): {}".format(
113114
nlines, emphasize_linespec
114115
),

0 commit comments

Comments
 (0)