Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
2600822
1
Parent(s):
d3c6385
Automatically load ipython extension
Browse files- pysr/julia_import.py +13 -0
pysr/julia_import.py
CHANGED
@@ -29,6 +29,19 @@ for k, default in (
|
|
29 |
):
|
30 |
os.environ[k] = os.environ.get(k, default)
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
from juliacall import Main as jl # type: ignore
|
33 |
|
34 |
|
|
|
29 |
):
|
30 |
os.environ[k] = os.environ.get(k, default)
|
31 |
|
32 |
+
|
33 |
+
def is_in_jupyter() -> bool:
|
34 |
+
try:
|
35 |
+
ipy = get_ipython().__class__.__name__ # type: ignore
|
36 |
+
return ipy == "ZMQInteractiveShell"
|
37 |
+
except NameError:
|
38 |
+
return False
|
39 |
+
|
40 |
+
|
41 |
+
if is_in_jupyter():
|
42 |
+
get_ipython().run_line_magic("load_ext", "julia.ipython") # type: ignore
|
43 |
+
|
44 |
+
|
45 |
from juliacall import Main as jl # type: ignore
|
46 |
|
47 |
|