rsalmei/alive-progress

Use in vscode jupyter

wedding0371 opened this issue · 6 comments

Hi there
I'm try alive-progress in vscode jupyter, but the output is none until code finish.

Then I used config that:
config_handler.set_global(force_tty=True)

It have progress output. But the output is confusion(Repeated output multiple times) Like this:

image

It's perfect worked in terminal and awesome. But I don't know how perfect work in the vscode jupyter.

This is my env:

Python 3.7.0;
alive-progress 3.1.2;
vscdoe 1.78.2;
jupyter v2023.4.1011241018;
jupyterr notebook renderers v1.0.15;

Hi, @wedding0371.

Well, I do not use vscode myself, but it seems pretty clear to me it is ignoring ANSI Escape Codes altogether.
Pycharm, for instance, does ignore them too by default, we have to set an option for alive-progress to work on it. Perhaps vscode does the same?

For Pycharm it was so common that I've included in the README: https://github.com/rsalmei/alive-progress#forcing-animations-on-pycharm-jupyter-etc, but no one has ever asked about it in vscode.
Could you try to find a similar option in your settings? Then I could include these instructions as well.
Thanks.

Oh, I've just realized you are using the jupyter notebook emulation within vscode.... 🤔
How does that work?

I do support jupyter notebooks, but with several workarounds, since in a browser they did not implement the ANSI Escape Codes at all as a terminal does.
And, I automatically detect jupyter environments, so perhaps it would be just a change to include this new kind of env.

Well, I was able to test it here, and it does work for me...
The default font is not suited for this, but it is perfect otherwise:

Screen.Recording.2023-05-25.at.23.27.00.mov

Hi @rsalmei

Thank you for reply :)
I'm sorry to forget this issure.

In fact it work perfect suddenly and i have no idea.
It's weird.
May be solved in installed the extension such as [Jupyter Notebook Renderers] or [Jupyter Slide Show] or some other.
image

In that time, i can't render echat in notebook so i install many extension, and solve this issure also.
It's my extensions about Jupyter, maybe can help someone. And i still used force_tty=True in my code and set the max_cols=100.

  • config_handler.set_global(force_tty=True)

  • dates = alive_it(self.dates, length=40, max_cols=100, enrich_print=False)

it's perfect!

image

Sure, no problem, I'm glad it works now.
Well, I do not have any of those extensions and it works for me too, but who knows, it surely can help someone.

Yes, it's very prefect and elegant.
Thank you for make this progress bar. 🤩