Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to add output prefixes to the REPL output and use that to implement an IPython mode #46474

Merged
merged 3 commits into from
Sep 15, 2022

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Aug 24, 2022

With

atreplinit() do repl
    if !isdefined(repl, :interface)
        repl.interface = REPL.setup_interface(repl)
    end
    REPL.ipython_mode(repl)
end

in the startup.jl file:

image

Only the first commit is needed for a package to implement the IPython mode (except prompt pasting which will not work from a package and currently requires a source change in REPL to modify the searched prefix).

Fixes #46310.

cc @eschnett

@KristofferC KristofferC added the REPL Julia's REPL (Read Eval Print Loop) label Aug 24, 2022
@KristofferC KristofferC requested a review from rfourquet August 24, 2022 08:14
@KristofferC
Copy link
Member Author

Seems pretty harmless and fun so I'll merge.

@KristofferC KristofferC merged commit e118845 into master Sep 15, 2022
@KristofferC KristofferC deleted the kc/output_prompts branch September 15, 2022 12:24
KristofferC added a commit that referenced this pull request Sep 15, 2022
… that to implement an IPython mode (#46474)"

This reverts commit e118845.
KristofferC added a commit that referenced this pull request Sep 15, 2022
… that to implement an IPython mode (#46474)" (#46780)

This reverts commit e118845.
aviatesk pushed a commit that referenced this pull request Dec 9, 2022
aviatesk pushed a commit that referenced this pull request Dec 9, 2022
… that to implement an IPython mode (#46474)" (#46780)

This reverts commit e118845.
@hyrodium
Copy link
Contributor

Is it correct to call this feature "ipython"? I'm understanding the origin of the format like In[1] and Out[1] is Mathematica.

@svretina
Copy link

svretina commented Nov 9, 2023

since the name changed, if anyone comes looking how to enable the numbered promt in startup, here is the snippet with the updated name:

atreplinit() do repl
    try
        @eval using REPL
    catch e
        @warn "error while imporing REPL" e
    end
    if !isdefined(repl, :interface)
        repl.interface = REPL.setup_interface(repl)
    end
    REPL.numbered_prompt!(repl)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Would like numbered REPL prompts
3 participants