allenai / cached_path

A file utility for accessing both local and remote files through a unified interface.
https://cached-path.readthedocs.io/
Apache License 2.0
35 stars 11 forks source link

Switch to `rich` for progress #94

Closed epwalsh closed 2 years ago

epwalsh commented 2 years ago

This is an experimental PR to get away from tqdm and start using rich for everything. Rich does a good job of automatically logging in a file-friendly way when it detects it's running in a non-interactive session. The behavior can also easily be customized by users by configuring rich's default Console. So I don't think there's any need to have our own FILE_FRIENDLY_LOGGING logic here. Hence that stuff has been removed.

We're already using rich for logging / pretty printing in tango and for progress bars in beaker-py. Might as well commit to rich and get rid of Tqdm across our ecosystems, in my opinion. So if ya'll agree with that, we can port this over to Tango as well and get rid out tango.common.tqdm.

dirkgr commented 2 years ago

What about users that use TQDM?

epwalsh commented 2 years ago

What about users that use TQDM?

Just because we use rich progress bars internally doesn't mean users can't use Tqdm for whatever else

dirkgr commented 2 years ago

Those will not be file friendly then. Which is OK, I guess.

For Tango, there is also a backwards compatibility issue. I have written a fair amount of code that uses Tango's TQDM.

epwalsh commented 2 years ago

Those will not be file friendly then. Which is OK, I guess.

The FILE_FRIENDLY_FLAG here doesn't affect TQDM globally anyway.

For Tango, there is also a backwards compatibility issue. I have written a fair amount of code that uses Tango's TQDM.

We could keep our TQDM class for backwards compat, but just use rich under the hood.

dirkgr commented 2 years ago

Does rich take the same kwargs?

epwalsh commented 2 years ago

There are probably some differences, but we could keep our Tqdm interface the same.