Skip to content

Commit bc0ecb0

Browse files
authored
Fix jupyter display (#395)
* use ipython display if not provided * get display from ns if available otherwise ipython
1 parent 95c283f commit bc0ecb0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sqlmesh/core/console.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,16 @@ class NotebookMagicConsole(TerminalConsole):
436436
"""
437437

438438
def __init__(
439-
self, display: t.Callable, console: t.Optional[RichConsole] = None, **kwargs: t.Any
439+
self,
440+
display: t.Optional[t.Callable] = None,
441+
console: t.Optional[RichConsole] = None,
442+
**kwargs: t.Any,
440443
) -> None:
441444
import ipywidgets as widgets
445+
from IPython.display import display as ipython_display
442446

443447
super().__init__(console, **kwargs)
444-
self.display = display
448+
self.display = display or get_ipython().user_ns.get("display", ipython_display) # type: ignore
445449
self.missing_dates_output = widgets.Output()
446450
self.dynamic_options_after_categorization_output = widgets.VBox()
447451

0 commit comments

Comments
 (0)