MRG: Fix verbose of mne.datasets fetching#10210
MRG: Fix verbose of mne.datasets fetching#10210larsoner merged 12 commits intomne-tools:mainfrom mscheltienne:tqdm_and_pooch_req
Conversation
|
Have you seen #10199 and the issue linked there? |
|
I did see the issue earlier, but not the PR! I didn't think you would change it so quickly. |
|
Maybe we should make both a soft dependency, not sure.
Triaging based on level whether or not to show a progress bar was intentional by design. To me if you're in verbose=True (info) mode you should see a bar and if warn or above, you shouldn't. This gives people direct call-by-call level control, rather than just deciding based on whether or not a package (pooch) is present. |
|
I think we need to decide which packages are core dependencies and which are optional dependencies. Fetching data sets should be considered a core functionality, and therefore I'd keep both I have also been thinking about our recurrent discussion on packages that are not pure Python. I don't think this should be a criterium for us to include a package as a dependency or not (otherwise we need to drop NumPy, SciPy, and Matplotlib). It is much more important if a package is actively maintained and provides a broad variety of binary wheels on PyPI. |
I was going to add it too; but I started with checking if I'll wait for the discussion/PRs on core dependencies to be merged before I continue this PR. |
I don't think you need to make any changes for this to be the case, it already works this way for me on
Since I'm going to be messing with this in #10199 a bit, I might get to this there. I think your |
|
I don't think it works as intended. After more testing using
To be confirm on macOS and Linux.. |
|
For the |
Here we go! I'm not a big fan of restricting what users are allowed to do in many situations. IMO the only advantage of kw-only args is that devs can freely shift around the order of parameters. Regarding |
Yes, if it becomes a core dependency, this problem is solved. For any related change, I will wait for #10199 and eventual follow-ups (and I will probably revert the soft-dependency change I already added here). |
We should maybe see if our code can force-remove even write-protected files. If it can't, we could update the dataset to have
Do you mean like this as a "did not have progress bar" (second call below)? If so, there is not much we should do I think -- sometimes GitHub will give you the file size, sometimes it won't (same might be true for osf.io, not sure?). We could make multiple requests but I think just having some updating display here is good enough -- when it was running, I could see the file size actually updating, so it was clear something was happening. And each person doesn't have to call these super often, so I'd say it's a low priority bug at least.
This I cannot replicate on macOS, assuming you did something like this: All we do is look for the existence of the |
|
I spoke too soon -- even on But after a |
No, I did twice:
This issue will be fixed when Also, I am getting progress bars with |
Pushed a commit to fix this.
Argh, yes I can replicate this. I think I understand why it's happening -- we used to triage based on the current #10199 should be in soon, so feel free to wait for that or continue fixing bugs here and rebase/merge later @mscheltienne ! |
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
|
Let's see if it's green:
Proposal:
|
+1 for this, simple enough (and more backward compatible) |
|
@larsoner Clearly I broke something by removing the |
It's testing to make sure module imports are nested. We try not to increase the number of modules we import at |
|
@larsoner Oh OK, that makes sense. Until now I believed it wasn't a good habit to nest the import in a function, but that's a very good point! I'll fix it. |
larsoner
left a comment
There was a problem hiding this comment.
Just needs latest.inc entry in the BUG section saying that verbose will be respected again when downloading data. Otherwise LGTM +1 for merge
|
Thanks @mscheltienne ! |


Closes #10022.
Outdated bullet points:
Keyword only arguments
If the proposal doesn't work for you, I can revert and at least set
verboseas keyword-only everywhere.tqdm
I've set
tqdmas a soft dependency. If it is not installed, progress bars are disabled. I think this is simpler than checking for the verbosity level and defining a limit for the progress bars.pooch
This one is a bit tricky, I will do it later.
The dependency is checked both in
fetch_datasetand in_download_mne_dataset.https://github.com/mscheltienne/mne-python/blob/37356f26cb765d74dc0b5fcf46c78bbbcbf22854/mne/datasets/_fetch.py#L130-L131
https://github.com/mscheltienne/mne-python/blob/37356f26cb765d74dc0b5fcf46c78bbbcbf22854/mne/datasets/utils.py#L151-L152