Skip to content

Commit

Permalink
Simplify IPython detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 9, 2024
1 parent 2600822 commit 20646f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pysr/julia_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@


def is_in_jupyter() -> bool:
try:
ipy = get_ipython().__class__.__name__ # type: ignore
return ipy == "ZMQInteractiveShell"
except NameError:
return False
return hasattr(__builtins__, "__IPYTHON__")


if is_in_jupyter():
get_ipython().run_line_magic("load_ext", "julia.ipython") # type: ignore
from IPython import get_ipython

get_ipython().run_line_magic("load_ext", "juliacall")


from juliacall import Main as jl # type: ignore
Expand Down

0 comments on commit 20646f9

Please sign in to comment.