Skip to content

Commit

Permalink
Merge pull request #49 from gamis/master
Browse files Browse the repository at this point in the history
Added disable_javascript_update
  • Loading branch information
tkrabel authored Jun 14, 2024
2 parents 02c83c6 + a3e435c commit 00bc64b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pyforest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from ._imports import *
from ._importable import disable_javascript_update
from .utils import (
get_user_symbols,
install_extensions,
Expand All @@ -15,7 +16,6 @@
if import_symbol not in user_symbols.keys():
user_symbols[import_symbol] = eval(import_symbol)


# set __version__ attribute
from pkg_resources import get_distribution, DistributionNotFound

Expand Down
9 changes: 9 additions & 0 deletions src/pyforest/_importable.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ def __repr__(self, *args, **kwargs):
return f"lazy pyforest.LazyImport for '{self.__import_statement__}'"


def disable_javascript_update():
"""
For use in non-Jupyter environments, disable _update_import_cell
"""
from pyforest import _importable
_importable._update_import_cell_disabled = _importable._update_import_cell
_importable._update_import_cell = lambda: None


def _update_import_cell():
try:
from IPython.display import display, Javascript
Expand Down

0 comments on commit 00bc64b

Please sign in to comment.