Skip to content

Commit a0cec45

Browse files
committed
Use user_ns = __main__.__dict__ so that py"..." works
1 parent 6b4b799 commit a0cec45

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ can switch back to Julia REPl by `backspace` or `ctrl-h` key (like
1616
other REPL modes). For older versions of IPython, exiting IPython as
1717
usual (e.g., `ctrl-d`) brings you back to the Julia REPL. Re-entering
1818
IPython keeps the previous state. Use pre-defined `Main` object to
19-
access Julia namespace from IPython.
19+
access Julia namespace from IPython. Use `py"..."` string macro to
20+
access Python namespace from Julia.
2021

2122
**Note:**
2223
First launch of IPython may be slow.

src/ipython_jl/entrypoints.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ def post_startup_configuration(ip):
2424

2525
def ipython_options(**kwargs):
2626
from traitlets.config import Config
27+
import __main__
2728

28-
user_ns = dict(
29+
# Use `__main__.__dict__` so that IPython namespace can be
30+
# retrieved from PyCall using `py"object"`.
31+
user_ns = __main__.__dict__
32+
user_ns.update(
2933
Main=get_main(**kwargs),
3034
)
3135

0 commit comments

Comments
 (0)