cid-harvard / py-ecomplexity

Python package to compute economic complexity and associated variables
MIT License
63 stars 24 forks source link

Added some neat verbosity #5

Closed hydrophis-spiralis closed 5 years ago

hydrophis-spiralis commented 5 years ago

Neat tqdm progress bar instead of just print function. :)

shreyasgm commented 5 years ago

Thanks so much for the PR!

This would definitely have been a neat addition, but tqdm still has some issues it needs to address before it's mature enough to be used in packages IMO. Examples - 1 and others described here.

Further, if you're using the package in Jupyter notebook, you'd have to explicitly import tqdm_notebook instead of tqdm for it to work. You could solve that using tqdm.autonotebook but then it doesn't work on JupyterLab in my experience. Do you know how other packages address these issues?

hydrophis-spiralis commented 5 years ago

I use tqdm.tqdm for a quite a lot of time, aside of some issues In jupyter notebooks(similar to issue you linked) it works fine. Moreover, it seems to be best python package available, however, there is another progress bar package https://github.com/Erotemic/progiter which I have no experience with. On tqdm.tqdm with Jupiter-notebook - it works and it outputs progress bar to standard output stream in text form. Maybe not so pretty as javascript generated by tqdm.tqdm_notebook, but it works.

shreyasgm commented 5 years ago

I can imagine KeyboardInterrupts being common while using py-ecomplexity. tqdm prints on multiple lines on Jupyter notebooks after KeyboardInterrupts if you don't using tqdm_notebook explicitly (as explained here and here). I'll merge this if we can solve this issue using tqdm.autonotebook, while maintaining functionality for JupyterLab.

Also, verbose needs to be boolean, and the case for verbose=False needs to be handled.

hydrophis-spiralis commented 5 years ago

I totally agree on tqdm issue.

As for verbose, lot of frameworks have verbosity as integer - it usually controls level of verbosity.