Skip to content

Conversation

@drammock
Copy link
Member

@drammock drammock commented Oct 1, 2021

Fixes a variety of problems with the implementation of fetch_dataset(). Also updates the version number and hash of the MNE-misc dataset, which just got a new release today.

@larsoner
Copy link
Member

larsoner commented Oct 1, 2021

Also updates the version number and hash of the MNE-misc dataset, which just got a new release today.

This will conflict with #9800, but @alexrockhill is an expert merger at this point so I think it's okay :)

# 2. get_config(key)
# 3. get_config('MNE_DATA')
path = get_config(key, get_config('MNE_DATA'))
path = get_config(key or 'MNE_DATA')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite get this one. It means that before if the config for the given key did not exist, we would use MNE_DATA, but now we only do so if key is None? This seems like an incorrect change in behavior?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is a sentinel value for get_config() that returns all config keys and their values that are defined in the config file. But here, key being None actually means something different (viz, "this dataset is MNE-external and is not kept track of in the config")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this change makes it so that, when key is None, we get the config value for "MNE_DATA" instead of a big dict of all defined config values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put another way, it updates the _get_path() function to gracefully handle key=None input, which previously it was not designed to handle.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh that makes sense, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you're right, maybe this should still include the fallback of get_config('MNE_DATA') for cases of non-empty strings that aren't valid config keys?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or valid ones that aren't set yet in the config, which is pretty common -- people just set MNE_DATA once then all downloads just automatically go to that location

@drammock drammock marked this pull request as ready for review October 1, 2021 22:28
@drammock
Copy link
Member Author

drammock commented Oct 1, 2021

@adam2392 can you review?

@larsoner
Copy link
Member

larsoner commented Oct 1, 2021

@adam2392 can you review?

@drammock can you force CIs to do some review work for us, too, by creating some new test that fails on main but passes on this PR? Presumably downloading some .mat file like in alphacsc/alphacsc#44 (comment) (I would look at pymatreader for some stable .mat testing file you could use) ? It looks like the only test adjustment is for a dataset version which looks reasonable, but wouldn't have caught the alphacsc error.

Feel free to ignore if this does not make sense or you were going to do this anyway...

@drammock
Copy link
Member Author

drammock commented Oct 4, 2021

can you force CIs to do some review work for us, too, by creating some new test that fails on main but passes on this PR?

done.

Copy link
Member

@adam2392 adam2392 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

Note: fatiando/pooch#266 will fix our issues with uncompressing members that are sub-directories.

@drammock
Copy link
Member Author

drammock commented Oct 4, 2021

Note: fatiando/pooch#266 will fix our issues with uncompressing members that are sub-directories.

did you test out fatiando/pooch#266 locally then? You should report back the result on that PR.

@drammock
Copy link
Member Author

drammock commented Oct 4, 2021

CI fails are unrelated:

  • test_notebook_alignment and test_notebook_button_counts: DeprecationWarning: Passing a schema to Validator.iter_errors is deprecated and will be removed in a future release. Call validator.evolve(schema=new_schema).iter_errors(...) instead.
  • test_3d_functions[mayavi]:
    • ResourceWarning: unclosed context
    • ResourceWarning: unclosed event loop

@larsoner larsoner merged commit 32f4ee8 into mne-tools:main Oct 4, 2021
@larsoner
Copy link
Member

larsoner commented Oct 4, 2021

Thanks @drammock !

larsoner added a commit to larsoner/mne-python that referenced this pull request Oct 7, 2021
@leouieda
Copy link

@drammock we'll be pushing a new release of Pooch today that should fix this bug. Please feel free to reopen the issue linked above if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants