-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Notebook output must support more ANSI sequences #118833
Comments
cc @DonJayamanne for the sequence in question |
I'll update this issue with samples of the special characters that we support today. |
Here are the special cases we have today (3 of them), anything beyond these would be an added bonus for anyone using VSCode to render streams. Control Characters reference https://en.wikipedia.org/wiki/ANSI_escape_code#Control_characters
Control Sequence reference https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences
|
FYI - In our older webview we have support for general ANSI color codes as well. |
Moved to Backlog since this has no owner, please change as appropriate. |
@DonJayamanne did you implement this as part of that streaming output perf issue? |
Bump, I would also be interested in a status update on this for the Julia extension :) |
@davidanthoff please could you share more information about the specific ANSI codes that Julia extension would need support for |
I just noticed https://code.visualstudio.com/updates/v1_80#_terminal-output-support last day, Is it possible to have terminal as notebook output renderer? (As separated extension) |
@DonJayamanne so I think in general the more the better, at the end of the day any package might just assume that things are run in a terminal that supports a lot of stuff. Having said that, there is one extremely popular package in the Julia ecosystem that shows progress bars that is really broken at the moment, and if we just added support for the sequences that are needed there it would go a very, very long way to improve things. The specific sequences that are need are |
Putting in another vote of support for this. Relevant ProgressBars.jl issue: cloud-oak/ProgressBars.jl#49. ProgressBars.jl needs basically the same ANSI sequences as ProgressMeter.jl (only difference is it also needs vertical movement via erase_to_end_of_line(output_stream::IO) = print(output_stream, "\033[K")
move_up_1_line(output_stream::IO) = print(output_stream, "\033[1A")
move_down_1_line(output_stream::IO) = print(output_stream, "\033[1B")
go_to_start_of_line(output_stream::IO) = print(output_stream, "\r") It's used as the main printing utility for the Python package pysr (1.4k⭐️) and Julia package SymbolicRegression.jl (450⭐️). Currently these packages cannot use progress bars in notebooks, so they have to fall back to regular printing. |
@DonJayamanne and @amunger just wanted to check in on this again, this is probably the number one pain point I have right now with the notebook stuff for Julia :) Is there anything from our end we could do to help move this forward? At least the limited set of ANSI sequences I indicated above? Thanks :) |
@davidanthoff sorry there hasn't been any update since, |
The current limited escape codes we handle are handled manually here with some related tests. We should be handling this more holistically, and I think there was a plan to do just that, but I'm not sure when we'll be able to get around to that. If you see a somewhat straightforward way to add in the set of escape codes that you need, I'd be happy to help review a contribution. |
@davidanthoff I just tried the following code and it works as expected p = Progress(10)
for i in 1:10
sleep(0.5)
next!(p)
end Also tried almost all the samples here https://github.com/timholy/ProgressMeter.jl and they all work as expected. It only fails to work when using the Julia VS Code extension |
I looked a bit more, and I think if we could fix julia-vscode/julia-vscode#3561 it would already be great progress. @DonJayamanne or @amunger if you could point me in the right direction for that issue it would be great! That still won't cover all cases: as soon as ProgressMeter.jl has a progress bar that also outputs additional info that would trigger a multi-line output (essentially |
follow up from #116416 (comment) and other discussions
Kernels often print stdout/stderr content with the assumption of being connected to a terminal. With that mindset they send ANSI sequences. Some of those sequences we support, like colors. We current don't support the sequence that clears the screen and that forces the jupyter extension to employ funny workarounds: they scan all output for that sequence, remember that so that they can clear the output before appending the next chunk. Things would be much simpler for them if we would simply support that ANSI sequence.
The text was updated successfully, but these errors were encountered: