Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mne.sys_info() #11544

Closed
wants to merge 26 commits into from
Closed

Refactor mne.sys_info() #11544

wants to merge 26 commits into from

Conversation

cbrnr
Copy link
Contributor

@cbrnr cbrnr commented Mar 8, 2023

This shortens the output of mne.sys_info() such that modules that are not installed are not printed in the output. I've also fixed some minor things like importing multiprocessing at the top (because it is available in the standard library) and removing the example (because this was outdated and it's probably not worth to change it everytime the function changes, plus I think it doesn't add any value).

Fixes #11543.

To do

  • Update dependencies parameter.
  • Add new use_unicode=True parameter?
  • Add an option to wrap lines?

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Okay with the general idea but I'd prefer to keep the sections, it's more readable for standard (complete) installs

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 8, 2023

The reason I removed the sections (I know it was intentional) is that it looks messy when packages are not installed. It also depends on which packages are installed/not installed whether or not there is a newline at the end of the output.

@larsoner
Copy link
Member

larsoner commented Mar 8, 2023

The reason I removed the sections (I know it was intentional) is that it looks messy when packages are not installed.

Sure but on the flipside now it looks messier for our most common / recommended installs (i.e., graphical installers or even environment.yml) where everything will be installed, e.g. for my system:

$ mne sys_info -d
Platform:            Linux-5.19.0-35-generic-x86_64-with-glibc2.36
Python:              3.10.7 (main, Nov 24 2022, 19:45:47) [GCC 12.2.0]
Executable:          /home/larsoner/.local/bin/python
CPU:                 x86_64: 8 cores
Memory:              62.8 GB

mne:                 1.4.dev0
numpy:               1.25.0.dev0+364.g341afc9000 {OpenBLAS 0.3.21.dev with 1 thread}
scipy:               1.11.0.dev0+1286.bd120df
matplotlib:          3.8.0.dev425+g3aa5386c38 {backend=QtAgg}
sklearn:             1.3.dev0
numba:               0.57.0dev0+952.g1304e64d0
nibabel:             5.1.0.dev3+g7327927f
nilearn:             0.10.1.dev
dipy:                1.6.0dev0
openmeeg:            2.6.0.dev1
pandas:              1.6.0.dev0+206.g4baeede019
pyvista:             0.39.dev0 {OpenGL 4.5.0 NVIDIA 470.161.03 via NVIDIA GeForce GTX 650 Ti BOOST/PCIe/SSE2}
pyvistaqt:           0.10.dev0
ipyvtklink:          0.2.2
vtk:                 9.2.5
qtpy:                2.4.0.dev0 {PyQt6=6.4.0}
ipympl:              0.9.2
pyqtgraph:           0.12.4
pooch:               v1.5.2
mne_bids:            0.13.dev0
mne_nirs:            0.5.dev0
mne_qt_browser:      0.5.dev0
mne_connectivity:    0.6.0dev0
sphinx:              5.3.0
sphinx_gallery:      0.12.0.dev0
numpydoc:            1.6.0rc1.dev0
pydata_sphinx_theme: 0.11.1rc1.dev0
pytest:              7.2.0.dev271+g1e0aa1690
nbclient:            0.7.2

So still -1 on me for removing the newlines

It also depends on which packages are installed/not installed whether or not there is a newline at the end of the output.

This is a behavior that could be changed by refactoring how/when the newlines are printed (i.e., only print one if you are about to print a new output "section")

@drammock
Copy link
Member

drammock commented Mar 8, 2023

WDYT about this: instead of giving one line to each "not found" package, there is a new section at the end that says

not found: sklearn, nibabel, numba, etc

The reason I suggest it is that, IMO, it is useful information: they can see that and think "oh, there are many optional packages, maybe the thing I'm trying to do needs one of them?" Put another way: if we simply omit the not-found packages, then the sys-info output usually (always?) looks "complete" as if there were nothing wrong.

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 8, 2023

To combine both of your suggestions, could we create section headings (e.g. "Required packages", "Developer packages (optional)", etc.) to make it clearer? If a section is completely empty, I would not show the heading either. Instead, we could have a final section ("Not installed packages (optional)" or similar) and list all of those packages in one line. I would try to avoid making it look as if missing optional packages indicates that something is wrong – MNE should work without any optional package.

@drammock
Copy link
Member

drammock commented Mar 8, 2023

MNE should work without any optional package

yes, but define "MNE should work". Not everything will work after pip install mne. If you consider things like running tests or building docs locally, not everything will work after conda install mne either. We don't currently list "developer packages" at all (if we did you'd see things like seaborn, neo, graphviz, pytest, etc).

Personally what makes the most sense to me is 5 sections:

  • system stuff (cores, RAM, etc)
  • MNE + core dependencies
  • optional packages (needed for some functionality)
  • ecosystem packages like mne-bids, mne-icalabel, etc. (call these "extensions"?)
  • dev ones (necessary for testing and doc building)

But adding the dev dependencies will make this list longer not shorter. Maybe a compromise would be

  1. always include the first 2 sections (I don't think they need section titles even; elements in them should always be there even if "not found").
  2. a section called "optional packages (needed for some functionality)" with one-per-line for installed packages and a single "not installed:" line with comma-separated package names for any optional deps that aren't installed
  3. a section called "extensions" with the same structure as "optional packages"

this proposal does not accept your idea @cbrnr of omitting entire sections if all packages in it are not installed. Again: IMO it's a useful discovery mechanism to see what could be there and utilized as well as what is already there and being utilized.

@larsoner
Copy link
Member

larsoner commented Mar 8, 2023

We already have a dev dependencies section enabled with -d from the command line (and something similar in the python interface). I think we already have sections close to the proposed organization, +1 for improving it and/or adding headers to make it clearer

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

@hoechenberger I just saw that you were also working on improving the output of mne.sys_info() in #11410. Would it be OK to combine our efforts in this PR (or in yours)? What is your opinion on the proposed changes? I think Emojis are already off the table (although I do think it looks super nice, but I understand the argument for compatibility with older systems which might not support emojis).

@hoechenberger
Copy link
Member

I think Emojis are already off the table

I don't think so, the use was just a bit excessive and I've toned it down since. Need to post a new screenshot and an explanation / justification. Maybe later today or sometime tomorrow

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

@drammock I agree with you that additional dependencies are necessary to make certain features of MNE work. I like the idea of having sections with titles, and as @larsoner has mentioned we have a switch to toggle dev dependencies (off by default). So the list shouldn't get longer in my case, and only a bit longer in your case (but it's more clearly structured).

I was wondering if there was a way to parse the dependencies from our requirements_*.txt files. Since they are not in the package folder, I have the feeling that importing them would require ugly hacks, and there is probably a better way to do it (maybe putting it in some Python object inside mne and parsing that in setup.py)? In any case, it would be nice to avoid duplicating our dependencies. Any ideas?

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

@hoechenberger and what is your opinion on the other points discussed here (i.e. shortening the list of not installed packages by putting them all on one line, adding section headings, single-sourcing dependencies)?

@agramfort
Copy link
Member

WDYT about this: instead of giving one line to each "not found" package, there is a new section at the end that says

not found: sklearn, nibabel, numba, etc

+1 on this

@drammock
Copy link
Member

drammock commented Mar 9, 2023

I was wondering if there was a way to parse the dependencies from our requirements_*.txt files.

FWIW here's what I do when generating package metadata:

# GET OUR DEPENDENCY VERSIONS
with open(os.path.join('..', 'setup.py'), 'r') as fid:
for line in fid:
if line.strip().startswith('python_requires='):
version = line.strip().split('=', maxsplit=1)[1].strip("'\",")
dependencies = [f'python{version}']
break
with open(os.path.join('..', 'requirements.txt'), 'r') as fid:
for line in fid:
req = line.strip()
for hard_dep in hard_dependencies:
if req.startswith(hard_dep):
dependencies.append(req)

I think this would change (I think easier?) when we switch to pyproject.toml instead of setup.py

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

It will probably simplify when using pyproject.toml, but the main issue I see here is that we need to evaluate our dependencies from within the mne package. I am not sure that this is possible, given that the requirements_*.txt files are probably not included in the installed package.

But it should be possible with pkg_resources or importlib or something similar I guess.

@drammock
Copy link
Member

drammock commented Mar 9, 2023

This requires python 3.8, our current min version is 3.7

In [8]: importlib.metadata.requires("mne")
Out[8]: 
['numpy>=1.15.4',
 'scipy>=1.1.0',
 'matplotlib',
 'tqdm',
 'pooch>=1.5',
 'decorator',
 'packaging',
 'jinja2',
 'h5io; extra == "hdf5"',
 'pymatreader; extra == "hdf5"',
 'pytest; extra == "test"',
 'pytest-cov; extra == "test"',
 'pytest-timeout; extra == "test"',
 'pytest-harvest; extra == "test"',
 'flake8; extra == "test"',
 'flake8-array-spacing; extra == "test"',
 'numpydoc; extra == "test"',
 'codespell; extra == "test"',
 'pydocstyle; extra == "test"',
 'check-manifest; extra == "test"',
 'twine; extra == "test"',
 'wheel; extra == "test"',
 'nitime; extra == "test"',
 'nbclient; extra == "test"',
 'sphinx-gallery; extra == "test"',
 'eeglabio; extra == "test"',
 'EDFlib-Python; extra == "test"',
 'pybv; extra == "test"',
 'imageio-ffmpeg; extra == "test"']

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

I was just about to post this 😄 – and I was going to say that it doesn't reflect all our requirements files (at least _doc is missing). But if this is sufficient, it does contain the separation between core and extra (test and hdf5) packages.

@drammock
Copy link
Member

drammock commented Mar 9, 2023

see also https://stackoverflow.com/a/70725798 about using packaging.requirements for parsing those requirements strings

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

And there's obviously a discrepancy between the packages output by mne.sys_info() (which contains e.g. sklearn, numba, nibabel, ...). So I think it would be helpful to consolidate our requirements, so that they are available in the package metadata.

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 9, 2023

Re Python 3.7, I have no problem bumping our minimum version to 3.8. SciPy is preparing for 3.9 on main I think, so they already require 3.8. Scikit-Learn requires 3.8 as well.

@drammock
Copy link
Member

drammock commented Mar 9, 2023

yeah, py3.7 EOL is 2023-06-27 so we should definitely bump

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 10, 2023

Here's the new output (the ✔︎ and ✘ symbols are only included if the terminal supports Unicode):

Platform              macOS-13.2.1-arm64-arm-64bit
Python                3.10.10 (v3.10.10:aad5f6a891, Feb  7 2023, 08:47:40) [Clang 13.0.0 (clang-1300.0.29.30)]
Executable            /Users/clemens/Projects/mne-python/.direnv/python-3.10.10/bin/python3
CPU                   arm (12 cores)
Memory                32 GB

# core (required)
✔︎ mne                 1.4.dev0
✔︎ decorator           5.1.1
✔︎ importlib_resources ?
✔︎ jinja2              3.1.2
✔︎ matplotlib          3.7.1 (MacOSX backend)
✔︎ numpy               1.24.2 (OpenBLAS 0.3.21 with 12 threads)
✔︎ packaging           23.0
✔︎ pooch               1.7.0
✔︎ scipy               1.10.1
✔︎ tqdm                4.65.0

# hdf5 (optional)
✘ Not installed: h5io, pymatreader

# test (optional)
✔︎ pytest              7.2.2
✘ Not installed: check-manifest, codespell, EDFlib-Python, eeglabio, flake8, flake8-array-spacing, imageio-ffmpeg, nbclient, nitime, numpydoc, pybv, pydocstyle, pytest-cov, pytest-harvest, pytest-timeout, sphinx-gallery, twine, wheel

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 10, 2023

With show_paths=True (output from a terminal without Unicode support):

Platform              macOS-13.2.1-arm64-arm-64bit
Python                3.10.10 (v3.10.10:aad5f6a891, Feb  7 2023, 08:47:40) [Clang 13.0.0 (clang-1300.0.29.30)]
Executable            /Users/clemens/.local/pipx/venvs/ipython/bin/python
CPU                   arm (12 cores)
Memory                32 GB

# core (required)
mne                   1.4.dev0 (/Users/clemens/Projects/mne-python/mne)
decorator             5.1.1 (/Users/clemens/.local/pipx/venvs/ipython/lib/python3.10/site-packages)
importlib_resources   ? (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/importlib_resources)
jinja2                3.1.2 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/jinja2)
matplotlib            3.7.1 (MacOSX backend) (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/matplotlib)
numpy                 1.24.2 (OpenBLAS 0.3.21 with 12 threads) (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/numpy)
packaging             23.0 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/packaging)
pooch                 1.7.0 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/pooch)
scipy                 1.10.1 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/scipy)
tqdm                  4.65.0 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/tqdm)

# hdf5 (optional)
Not installed: h5io, pymatreader

# test (optional)
pytest                7.2.2 (/Users/clemens/Projects/mne-python/.direnv/python-3.10.10/lib/python3.10/site-packages/pytest)
wheel                 0.38.4 (/Users/clemens/.local/pipx/shared/lib/python3.10/site-packages/wheel)
Not installed: check-manifest, codespell, EDFlib-Python, eeglabio, flake8, flake8-array-spacing, imageio-ffmpeg, nbclient, nitime, numpydoc, pybv, pydocstyle, pytest-cov, pytest-harvest, pytest-timeout, sphinx-gallery, twine

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 10, 2023

BTW, aligning strings with the checkmark using ljust() is weird, because the ✔︎ symbol has length 2 (already fixed, but I thought it is worth mentioning).

I think having the checkmarks (when possible) is worthwile, because they make it clear that a listed package is installed. We could think about adding a new parameter if someone really wants to explicitly change that.

@cbrnr cbrnr force-pushed the shorten-sys_info branch from 410bada to 921bea4 Compare March 15, 2023 08:36
@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 15, 2023

OK, I think the new output looks quite nice already, but now it's question time. With the new way of determining dependencies with importlib.metadata.requires(), we have to make do what's defined there. This means we cannot use the dependencies parameter as before, which had two possible values "user" and "developer". Now we have a distinction between core and extra packages (where extra packages are further divided into different categories "hdf5" and "test" at the moment). I'd prefer reflecting this structure in the output as opposed to creating our own custom categories here (which we will need to constantly update if something changes). If at all, I'd tweak the extra categories directly.

And a quick unrelated note: maybe we should enforce line wraps?

WDYT?

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 15, 2023

It seems we're hitting this issue, which has already been fixed (but there's no release yet). Not sure why twine is even here in the first place...

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 15, 2023

It might be related to an old version of a vendored importlib_metadata. I'm including the requirement again to see if this fixes the problem.

Nope, that didn't fix it.

@larsoner
Copy link
Member

Pushed a commit to ignore the dep warning coming from other package imports (we could also put it at the level of the sys_info test but I think the main conftest level is okay).

On my system I get:

$ mne sys_info
Platform              Linux-5.19.0-35-generic-x86_64-with-glibc2.36
Python                3.10.7 (main, Nov 24 2022, 19:45:47) [GCC 12.2.0]
Executable            /home/larsoner/.local/bin/python
CPU                   x86_64 (8 cores)
Memory                62 GB

# core (required)
✔︎ mne                 1.4.dev0
✔︎ decorator           5.1.0
✔︎ importlib_resources ?
✔︎ jinja2              3.1.2
✔︎ matplotlib          3.8.0.dev425+g3aa5386c38 (QtAgg backend)
✔︎ numpy               1.25.0.dev0+364.g341afc9000 (OpenBLAS 0.3.21.dev with 1 thread)
✔︎ packaging           23.0
✔︎ pooch               1.5.2
✔︎ scipy               1.11.0.dev0+1286.bd120df
✔︎ tqdm                4.64.1

# hdf5 (optional)
✔︎ h5io                0.1.7
✔︎ pymatreader         0.0.30

# test (optional)
✔︎ eeglabio            0.0.1-7
✔︎ flake8              6.0.0
✔︎ nbclient            0.7.2
✔︎ nitime              0.9
✔︎ numpydoc            1.6.0rc1.dev0
✔︎ pybv                0.7.4
✔︎ pydocstyle          6.1.1
✔︎ pytest              7.2.0.dev271+g1e0aa1690
✔︎ twine               4.0.2
✔︎ wheel               0.38.4
✘ Not installed: check-manifest, codespell, EDFlib-Python, flake8-array-spacing, imageio-ffmpeg, pytest-cov, pytest-harvest, pytest-timeout, sphinx-gallery

The Not installed is incorrect, I think I have all but one or two of those. Maybe some --to_ conversion issue? Also EDFlib-Python probably needs an alias. So you might want --to-_ automatic conversion plus an alias dict with a .get(

@drammock
Copy link
Member

this aspect of @larsoner's output is weird to me:

✔︎ importlib_resources ?

why does it get a checkmark if it's version is unknown/undetermined? (aside: I'm still -1 on using emoji at all, I just don't see what it adds here)

@cbrnr cbrnr changed the title Shorten mne.sys_info() Refactor mne.sys_info() Mar 16, 2023
@cbrnr cbrnr changed the title Refactor mne.sys_info() Refactor mne.sys_info() Mar 16, 2023
@larsoner
Copy link
Member

Output looks reasonable for me:

Output
$ mne sys_info -d
Platform               Linux-5.19.0-35-generic-x86_64-with-glibc2.36
Python                 3.10.7 (main, Nov 24 2022, 19:45:47) [GCC 12.2.0]
Executable             /home/larsoner/.local/bin/python
CPU                    x86_64 (8 cores)
Memory                 62 GB

# core (required)
mne                    1.4.0.dev76+gbc47d98992
decorator              5.1.0
importlib_resources    5.12.0
jinja2                 3.1.2
matplotlib             3.8.0.dev425+g3aa5386c38 (QtAgg backend)
numpy                  1.25.0.dev0+364.g341afc9000 (OpenBLAS 0.3.21.dev with 1 thread)
packaging              23.0
pooch                  1.5.2
scipy                  1.11.0.dev0+1286.bd120df
tqdm                   4.64.1

# hdf5 (optional)
h5io                   0.1.7
pymatreader            0.0.30

# test (optional)
check-manifest         0.48
codespell              2.2.3.dev321+gc64c4ec0
edflib-python          1.0.6
eeglabio               0.0.1.post7
flake8                 6.0.0
imageio-ffmpeg         0.4.5
nbclient               0.7.2
nitime                 0.9
numpydoc               1.2.2.dev0
pybv                   0.7.4
pydocstyle             6.1.1
pytest                 7.2.0.dev271+g1e0aa1690
pytest-cov             3.0.0
pytest-harvest         1.10.4
pytest-timeout         1.4.2
sphinx-gallery         0.12.0
twine                  4.0.2
wheel                  0.38.4
Not installed: flake8-array-spacing

@@ -198,23 +197,20 @@ stages:
- bash: |
set -e
mne sys_info -pd
mne sys_info -pd | grep "qtpy: .*{PySide6=.*}$"
Copy link
Member

Choose a reason for hiding this comment

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

It's really useful to have qtpy in there and the backend used when debugging people's info, so I'd like to see this come back in / be adjusted in some form rather than be removed

@@ -7,4 +7,4 @@ pooch>=1.5
decorator
packaging
jinja2
importlib_resources>=5.10.2
importlib_resources>=5.10.2; python_version < '3.9'
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depends on which functionality you need. The version in the standard library lags behind the PyPI package: https://pypi.org/project/importlib-resources/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need importlib.resources.files, which was added in 3.9: https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files

@@ -0,0 +1,2 @@
mne-qt-browser
PySide6
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 think this should be added here but rather qtpy.

If we had to pick one PyQt6 would be better anyway until PySide6 fixes the matplotlib-interactive-doesn't-work bug

@larsoner
Copy link
Member

Output looks reasonable for me:

I take that back actually. In addition to qtpy not being listed (and not listing its backend in a parenthetical), I don't see a way to get it from the command line as -d doesn't supply it. So a --all should probably be added. But even when doing:

$ python -c "import mne; mne.sys_info(dependencies='all')"

I don't see qtpy or pyvista (with its useful extended OpenGL info), pyvistaqt, etc. listed. Did I miss something? If not, can you make sure that there is some easy way to make the set of dependencies reported when using mne sys_info --all on this PR to be a super set of those when doing mne sys_info on main?

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 17, 2023

Re some packages missing (such as qtpy): that's because they are currently not dependencies. We do list PySide6 in requirements.txt as opposed to qtpy, so that's why I added that in an extra group. The solution is to create more extra group with all packages that you would like to see, that's why I was asking for suggestions which groups should get which packages (and also to make our actually used requirements_*.txt files consistent with requirements.txt, which is not used by setup.py).

@larsoner
Copy link
Member

Re some packages missing (such as qtpy): that's because they are currently not dependencies.

Taking a step back, I don't think this should be the inclusion criteria/guiding force here. You seem to be making multiple changes (?):

  1. Reorganize dep list into sections with headings
  2. Add to dep list stuff that's missing (like the incomplete "core" list)
  3. Remove from dep list anything that can't be installed with pip install mne[<something>]

(1) and (2) are great but (3) I don't think is a good idea. Or at least should be done separately, since changing the install options should be out of scope for this PR.

The point of mne sys_info is very often -- 99% of the time out of the hundreds I've seen it used since its inception probably -- is to help users debug some problem. Often that has meant helping with OpenGL issues, so you want to see pyvista and the extra info. Or it means helping with Qt issues, so you want to see qtpy (which is used by mne-qt-browser and pyvistaqt) and the backend that qtpy will use, and the Qt version of that backend.

The most important thing to me is not losing these behaviors / this info. I already consider it a loss that we will now need to do extra work to get all the useful information compared to before. Now mne sys_info has been shortened to just "core" (10 modules) instead of the much longer list on main (26). I think I'd prefer that all relevant installed packages be listed, and if you really want just core you do mne sys_info --core. This is much more backward compatible.

At the end of the day we want info from a bunch of modules that are not dependencies, including stuff like mne-bids. At the same time, we don't want to add all of these to new/different requirements_<whatever>.txt files and add them to setup.py. So I'm not convinced making a bunch of new requirements_whatever.txt and making that have a 1:1 relationship with mne sys_info is the way to go.

I found the curated groups we had before easier to parse and think about for the purposes the function is meant to serve. It might be easier to go back to that method and just improve the printing / organization...

that's why I was asking for suggestions which groups should get which packages

... the curated list we have on main is already a starting point -- it's roughly "core" "optional" and "mne ecosystem" or so. But you also have a list from @drammock above (#11544 (comment)) that you could build from.

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 17, 2023

(1) and (2) are great but (3) I don't think is a good idea.

You really want to duplicate and/or manually curate yet another list of packages? I was assuming (maybe mistakenly) that parsing all relevant packages automatically would be preferred.

And yes, this PR evolved a bit from mere cosmetics to trying to organize our dependencies.

@hoechenberger
Copy link
Member

I was assuming (maybe mistakenly) that parsing all relevant packages automatically would be preferred.

I honestly don't think it's worth the hassle unless it's trivial to do (which apparently it's not)

@larsoner
Copy link
Member

You really want to duplicate and/or manually curate yet another list of packages? I was assuming (maybe mistakenly) that parsing all relevant packages automatically would be preferred.

Yes for now, at the very least for categorization. Maybe someday we want pip install mne[<whatever>] to give a subset of what mne sys_info's categories are by tying both to a bunch of requirements_<whatever>.txts, but I don't think we're there yet / should do it in this PR. You could try parsing all the currently available requirements_*.txt files, but still I bet we'll want some stuff in requirements.txt in different categories so you'll end up needing a manual list for that. And we probably want stuff that isn't in any requirement.txt file so you'll need a manual list for that.

If you're worried about this and want to check consistency in the meantime, you could create a dict of heading->modules in mne/utils/config.py, then in a tiny unit test check that everything in requirements*.txt show up in that list. That way we ensure stuff stays up to date, but still have the flexibility to make the list in mne sys_info be in the order that makes the most sense (probably the one @drammock proposed) and that pip install mne[<whatever>] makes the most sense (still TBD, may or may not match @drammock's categories).

@larsoner
Copy link
Member

Looking at mne sys_info on main again I think the current list is actually intentionally incomplete -- it contains packages that we've seen by experience and/or expect that we'll need to know about to debug user issues. So I'm not sure we want everything in requirements.txt listed, I'm not sure it's helpful in 99% of use cases (where we'll just ask them about a pip list separately or so).

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 17, 2023

I honestly don't think it's worth the hassle unless it's trivial to do (which apparently it's not)

Now that I put in a decent amount of time it is trivial to do, but not possible because we want to include packages in mne.sys_info() which are not dependencies.

OK, I'll revert to the hand-picked list of packages then and remove all attempts to parse anything from our requirements.

@cbrnr
Copy link
Contributor Author

cbrnr commented Mar 17, 2023

Superseded by #11568.

@cbrnr cbrnr closed this Mar 17, 2023
@cbrnr cbrnr deleted the shorten-sys_info branch March 21, 2023 08:04
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.

Do not list not installed packages in mne.sys_info()
5 participants