Skip to content

Commit

Permalink
Automatically load ipython extension
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 9, 2024
1 parent d3c6385 commit 2600822
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pysr/julia_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
):
os.environ[k] = os.environ.get(k, default)


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


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


from juliacall import Main as jl # type: ignore


Expand Down

0 comments on commit 2600822

Please sign in to comment.