Show progress bar in interactive sessions (Jupyter, REPL) by default - #1065
Conversation
|
|
| provider: Optional[str] = None, | ||
| threads: int = 8, | ||
| *, | ||
| hide_progress: bool = False, |
There was a problem hiding this comment.
I don't feel we should add a new kwarg here. Currently pqdm_kwargs.disable allows the user to control this behavior, and perhaps this PR should just update the default value instead of introducing a new API element?
There was a problem hiding this comment.
I.e.
pqdm_kwargs = {
"n_jobs": threads,
"disable": not _is_interactive(),
**(pqdm_kwargs or {}),
}There was a problem hiding this comment.
makes sense, I feel like pqdm is kind of "obscure" and hide_progress is very explicit.
There was a problem hiding this comment.
That's definitely true. You've kinda convinced me :) this is end-user-facing and we want it to be user-friendly. Maybe it should be show_progress instead? hide_progress=False is a double-negative.
There was a problem hiding this comment.
@mfisher87 it will be great if we can merge this to unblock #1061 and try to release v0.15.0 at the end of the week!
mfisher87
left a comment
There was a problem hiding this comment.
I may not be able to do another pass this week. I have events going on every day after today 😅
| except ImportError: | ||
| pass | ||
|
|
||
| import sys |
There was a problem hiding this comment.
Move import to the top of the module?
| **(pqdm_kwargs or {}), | ||
| } | ||
|
|
||
| return pqdm(url_mapping.items(), multi_thread_open, **pqdm_kwargs) |
There was a problem hiding this comment.
pqdm_kwargs could be None at this point, so it's possible the user will be NoneType is not a mapping on this line.
There was a problem hiding this comment.
I think that's why the or {} is there no?
There was a problem hiding this comment.
@betolink, correct, that's what the or {} is for.
There was a problem hiding this comment.
@betolink I show that line as deleted, so can't it still be None?
There was a problem hiding this comment.
(paraphrasing an LLM) you're totally right! I think we should include the or {} in this line as well, technically this is not a public method and the methods that call it have the or {}, should we open an issue for it?
Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com>
Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com>
Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com>
Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com>
|
Hi @chuckwondo if you have time, it would be great to have your input on this one. Just a minor edit on how we expose the progress bar. I'm waiting on this to keep working on #1061 |
|
Thanks @betolink! I'll take a look at this today. |
chuckwondo
left a comment
There was a problem hiding this comment.
Looks good! Approving, with just a few minor suggestions.
| **(pqdm_kwargs or {}), | ||
| } | ||
|
|
||
| return pqdm(url_mapping.items(), multi_thread_open, **pqdm_kwargs) |
There was a problem hiding this comment.
@betolink, correct, that's what the or {} is for.
| of a UUID4 value. | ||
| provider: if we download a list of URLs, we need to specify the provider. | ||
| threads: parallel number of threads to use to download the files, adjust as necessary, default = 8 | ||
| show_progress: whether to display a progress bar. Defaults to `True` for interactive sessions, otherwise `False`. |
There was a problem hiding this comment.
| show_progress: whether to display a progress bar. Defaults to `True` for interactive sessions, otherwise `False`. | |
| show_progress: whether or not to display a progress bar. If not specified, defaults to `True` for interactive sessions (i.e., in a notebook or a python REPL session), otherwise `False`. |
Please also duplicate this description to the rest of the places where show_progress was added so that the description is consistent everywhere. (There's a fair bit of variation/inconsistency across the other spots.)
There was a problem hiding this comment.
done! I'm taking a look at the pre-commit error.
|
@betolink, be sure to merge main into your branch, and address the pre-commit error. |
Co-authored-by: Chuck Daniels <cjdaniels4@gmail.com>
|
Ah my origin/main is not in sync with earthaccess/main, fixing that now! |
chuckwondo
left a comment
There was a problem hiding this comment.
Thanks @betolink! Looks good to me!

This is a minor patch to restore the progress bar when we open and download files, the default is to show it if we are in a notebook and there is a new parameter to mute it with
hide_progressin both download() and open().📚 Documentation preview 📚: https://earthaccess--1065.org.readthedocs.build/en/1065/