fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.97k stars 286 forks source link

More comfortable console output #1999

Open j-fu opened 2 years ago

j-fu commented 2 years ago

Hi, I appreciate the possibilty to print output to the console.

fonsp commented 2 years ago
  1. Yes! Should be possible with a max-width: ... somewhere. A PR would be great! 🎉
  2. With the old behaviour, do you mean not capturing stdout at all?
j-fu commented 2 years ago

Ok will see if I find time for the PR during the weekend.

For the "old behavior": probably yes, just seeing stdout in the console. I think this is also a bit related to #1988 .

this-josh commented 2 years ago

I'm not sure if this is worth opening its own ticket as it seems to fall under "more comfortable console output". On my M1 mac the console background moves when my cursor hovers over it. Note this occurs with any number of lines, I just used two to make it easier to see.

Versions tested:

It's clearly not a big deal, but it's probably worth noting.

https://user-images.githubusercontent.com/59419126/162152444-1dc4c4f6-4d3f-4c85-ab7f-64c1bc040cb6.mov

disberd commented 2 years ago

Regarding 1), a quick hack to avoid the stdout getting huge is easy to get with CSS by adding a cell with this code:

html"""
<style>
    pluto-log-dot.Stdout {
        max-height: 300px;
        overflow: auto;
    }
</style>
"""

image

This has the problem that the retro-console effect is also present on the scrollbar. Avoiding this needs some more investigation/tweaking.

disberd commented 2 years ago

I'm not sure if this is worth opening its own ticket as it seems to fall under "more comfortable console output". On my M1 mac the console background moves when my cursor hovers over it. Note this occurs with any number of lines, I just used two to make it easier to see.

Versions tested:

  • Pluto v0.18.4, Julia 1.8.0-beta3+0~aarch64
  • Pluto v0.18.4, Julia 1.7.2+0~aarch64
  • Pluto v0.18.4, Julia 1.7.2+0~x64
  • Pluto v0.19.0, Julia 1.7.2+0~x64

It's clearly not a big deal, but it's probably worth noting.

scrolling_in_console_output.mov

Hi @this-josh, I seem to remember that this was intended to give the "retro console" feeling but only during hover probably to avoid having animations running all over the notebook.

j-fu commented 2 years ago

I didn't have the time to make a PR yet for this, but my favorite would be something around the way it works in PlutoUI (the with_terminal() thing):

https://github.com/JuliaPluto/PlutoUI.jl/blob/3e3e7c68034978c3db8581ac3f1cf7af4817a901/src/TerminalNotebook.jl#L97

(Disclaimer: I was responsible for that PR...)

j-fu commented 2 years ago

There will be more requests like that... May be there should be an API to control these aspects of the layout according to the user's taste ? See https://julialang.zulipchat.com/#narrow/stream/243342-pluto.2Ejl/topic/manipulating.20log.20output/near/293706605

jcbritobr commented 1 year ago

Well what I see and I think its a problem is the output of DataFrames being ocluded by the console color. Maybe a bit more light. I dont know if its a DataFrame Issue, but I think this output maybe more clear and simple.

image

image

disberd commented 1 year ago

Is there a specific reason why you want to print the dataframe to the console inside Pluto rather than just displaying it as output of the cell or using the nicer formatted logs you can obtain by doing @info data rather than println(data)?

jcbritobr commented 1 year ago

Is there a specific reason why you want to print the dataframe to the console inside Pluto rather than just displaying it as output of the cell or using the nicer formatted logs you can obtain by doing @info data rather than println(data)?

No. Just pointing some thing is not working well. Also, @info is ugly. image

Just comparing with ijulia on jupyter. Is quite simple and objective image

I like Pluto a lot, and I want it get even better.