Skip to content

Conversation

@larsoner
Copy link
Member

@larsoner larsoner commented Jan 13, 2022

Implements the plan from #10198 (comment).

Will iterate until green, then do a [circle full] build.

Close #10198

Todo:

  • Update README.rst with jinja2 and the other hard deps here
  • Make nested imports for h5io and pymatreader so that h5py is not a hard dependency.
  • Add jinja2 files to setup.py data list

@larsoner larsoner marked this pull request as ready for review January 14, 2022 18:02
@larsoner
Copy link
Member Author

Okay we're all green, so this is ready for review/merge from my end.

The only thing I realized that I missed in #10198 (comment) is that we now implicitly also have a hard dependency on h5py, which is not pure Python. If this is problematic, we could move back to having optional dependencies on pymatreader and h5io (both of which depend on h5py) -- this would affect read_raw_nirx, read_raw_eeglab, and any I/O that uses HDF5 under the hood (morphing, TFR, some STCs).

I think my vote is to try the hard dependency on h5py and if we get reports of problems from people, make them optional. Plus I think with the mne-installers coming around that should hopefully serve 99% of our users (at least the ones who couldn't figure out how to get h5py working on their own) hopefully we're in safe territory anyway.

@larsoner larsoner added this to the 1.0 milestone Jan 14, 2022
@cbrnr
Copy link
Contributor

cbrnr commented Jan 14, 2022

+1 for including h5py and monitoring it closely. Also, this means that we could replace edflib-python with pyedflib (which is much faster). BTW, this package is not in any requirements file (it should not be in base I think).

Did you decide what is a base dependency by what we previously vendored?

@larsoner
Copy link
Member Author

Did you decide what is a base dependency by what we previously vendored?

That plus adding pooch (to remove the need for mne[data]) and packaging for #10197, i.e., just following my previous suggestion/idea as much as possible (#10198 (comment))

@larsoner
Copy link
Member Author

BTW, this package is not in any requirements file (it should not be in base I think).

Yes we do not currently have a requirements_export.txt or anything like that, though we could add it.

@larsoner larsoner mentioned this pull request Jan 14, 2022
@agramfort
Copy link
Member

my only big concerns is about h5io and pymatreader. For me it's not a core requirement of the package and I have terribly painful experience with hdf5 dependencies in the past. It's not a core package from the scipy stack and the risk of technical dept is for me very real. I would vote to keep h5io and pymatreader optional dependencies.

my 2c

@cbrnr
Copy link
Contributor

cbrnr commented Jan 15, 2022

Also, we never vendored these packages before, so this seems like a different issue than just replacing the vendored packages. What was the situation before this PR? They were optional dependencies, right?

@larsoner
Copy link
Member Author

Before, we vendored the code and nested the import of the libraries that need h5py. We could continue to nest them to keep them as soft rather than hard dependencies. I'll make that change

@agramfort
Copy link
Member

agramfort commented Jan 16, 2022 via email

@hoechenberger
Copy link
Member

We could continue to nest them to keep them as soft rather than hard dependencies. I'll make that change

I like this idea.

@larsoner larsoner requested a review from sappelhoff as a code owner January 17, 2022 23:03
@larsoner
Copy link
Member Author

Okay I ended up adding an optional pip install mne[hdf5] for people who want HDF5 support. This is ready for review/merge from my end.

Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
Copy link
Member

@hoechenberger hoechenberger left a comment

Choose a reason for hiding this comment

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

There's actually two subdirs in html_templates, albeit with very similar names 🙈

@hoechenberger
Copy link
Member

hoechenberger commented Jan 18, 2022

Oh you already fixed it while I was typing my comment! 🚀

Copy link
Contributor

@cbrnr cbrnr left a comment

Choose a reason for hiding this comment

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

Looks good, just a few comments/questions.

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

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

LGTM. A couple non-blocker subjective comments

  1. the pip requirements_* files seem to be multiplying... is there need/value in specifying them in separate text files rather than directly in setup.py?
  2. for the install shorthands, to me it seems the fewer options the better; something like:
  • pip install mne # base
  • pip install mne[hdf5] # + hdf5 / export deps; other shortands could be "io" or "export"
  • pip install mne[dev] # everything above + doc and testing deps; could also be "all"

so if we find ourselves wanting to add more and more install shorthands as our dependencies evolve, I'd rather think about how to shoe-horn new deps into one of those 3 levels.

Comment on lines +55 to +57
with warnings.catch_warnings(record=True):
warnings.simplefilter('ignore')
return eval(f'parse("{version_a}") {operator} parse("{version_b}")')
Copy link
Member

Choose a reason for hiding this comment

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

can you explain why this change was needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

parse emitted a warning because some package had a non-PEP440-compliant version. We should hide these from the user, they shouldn't hear about this issue. (It didn't break the comparison in this case anyway -- I think it was a .develop or something at the end.)

@larsoner
Copy link
Member Author

the pip requirements_* files seem to be multiplying... is there need/value in specifying them in separate text files rather than directly in setup.py?

The need/value arises because our CIs make use of them in different ways depending on the different run type (conda, pip, minimal, old, doc-build, notebook, ultraslow, etc.). I'll open a separate issue for this since I think this problem exists to some extent in main so I think we should tackle it separately (even though this PR exacerbates the problem).

for the install shorthands, to me it seems the fewer options the better; something like:

In main we currently have [data]. This PR just adds [hdf5]. Your proposal also includes [hdf5], and adds [dev], but omits [data]. Regarding [data], I think we should keep it -- multiple downstream packages recently had to start doing pip install mne[data] because we broke dataset downloading for them. If we remove it, we're making another breaking change for them. Leaving [data] in as a no-op is a low-cost (to us) way to not break their workflows.

If we keep [data], your proposed set of options is a superset of the ones here, so again I think we can do it in another PR.

I'd rather think about how to shoe-horn new deps into one of those 3 levels.

Agreed this would be cleaner if we can do it. I'll open a separate issue for this.

@drammock
Copy link
Member

Regarding [data], I think we should keep it -- multiple downstream packages recently had to start doing pip install mne[data] because we broke dataset downloading for them. If we remove it, we're making another breaking change for them. Leaving [data] in as a no-op is a low-cost (to us) way to not break their workflows.

+1, I have no objection keeping legacy shorthands as synonyms for ones that we consider "current" and advise people to use.

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

merge if happy !

thx heaps @larsoner 👏 🙏

@hoechenberger hoechenberger merged commit 6e312e1 into mne-tools:main Jan 19, 2022
@hoechenberger
Copy link
Member

Thanks @larsoner!

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.

MAINT: Vendoring policy

5 participants