Skip to content

Commit e1da4c0

Browse files
authored
Clean up old version usages and SPEC0 pin a few more deps (#14108)
1 parent b4decce commit e1da4c0

31 files changed

Lines changed: 144 additions & 321 deletions

doc/changes/dev/14108.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixed bug in :meth:`mne.io.Raw.plot` where, with the matplotlib backend and
2+
``group_by="selection"``, the channel-selection radio buttons no longer all appeared
3+
selected while in butterfly mode, by `Eric Larson`_.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Raised minimum versions of some optional dependencies to comply with MNE-Python's
2+
SPEC0-like policy, and added them to the set kept up to date automatically by the
3+
``spec_zero`` CI job, by `Eric Larson`_:
4+
5+
- Optional dependency ``dipy >= 1.9``
6+
- Optional dependency ``mne-qt-browser >= 0.6``
7+
- Optional dependency ``nibabel >= 5.2``
8+
- Optional dependency ``nilearn >= 0.10``
9+
- Optional dependency ``numba >= 0.60``

doc/sphinxext/gh_substitutions.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,8 @@
22
# License: BSD-3-Clause
33
# Copyright the MNE-Python contributors.
44

5-
import docutils
65
from docutils.nodes import reference
7-
8-
# Adapted from sphinx
9-
if docutils.__version_info__[:2] < (0, 22):
10-
from docutils.parsers.rst import roles
11-
12-
def _normalize_options(options):
13-
if options is None:
14-
return {}
15-
n_options = options.copy()
16-
roles.set_classes(n_options)
17-
return n_options
18-
19-
else:
20-
from docutils.parsers.rst.roles import (
21-
normalize_options as _normalize_options,
22-
)
6+
from docutils.parsers.rst.roles import normalize_options as _normalize_options
237

248

259
def gh_role(name, rawtext, text, lineno, inliner, options={}, content=[]): # noqa: B006

environment.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- darkdetect
1111
- decorator >=5.1
1212
- defusedxml
13-
- dipy >=0.8
13+
- dipy >=1.9
1414
- edfio >=0.4.10
1515
- eeglabio
1616
- ffmpeg =8.1.2
@@ -30,13 +30,13 @@ dependencies:
3030
- mamba
3131
- matplotlib >=3.9
3232
- mffpy >=0.11.0
33-
- mne-qt-browser
33+
- mne-qt-browser >=0.6
3434
- nest-asyncio2
35-
- nibabel >=2.0
36-
- nilearn
35+
- nibabel >=5.2
36+
- nilearn >=0.10
3737
- nomkl
3838
- noqt5
39-
- numba >=0.35
39+
- numba >=0.60
4040
- numpy >=2.0,<3
4141
- openmeeg >=2.5.7
4242
- packaging

examples/decoding/decoding_xdawn_eeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
# Create classification pipeline
7474
kwargs = dict()
75-
if check_version("sklearn", "1.8"):
75+
if check_version("sklearn", "1.8"): # TODO VERSION remove on sklearn 1.8+
7676
kwargs["l1_ratio"] = 1
7777
else:
7878
kwargs["penalty"] = "l1"

examples/stats/r_interop.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# We use the MNE sample dataset and create epochs for two conditions:
3131
# auditory/left and auditory/right.
3232

33+
import numpy as np
3334
import rpy2.robjects as ro
3435
from rpy2.robjects import default_converter, numpy2ri
3536
from rpy2.robjects.conversion import localconverter
@@ -142,3 +143,4 @@
142143

143144
print(f"\nt difference: {abs(t_python - t_r):.2e}")
144145
print(f"p difference: {abs(p_python - p_r):.2e}")
146+
np.testing.assert_allclose([t_python, p_python], [t_r, p_r], rtol=1e-10)

mne/bem.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
write_int_matrix,
3434
write_string,
3535
)
36-
from .fixes import _compare_version, _safe_svd
36+
from .fixes import _safe_svd
3737
from .surface import (
3838
_complete_sphere_surf,
3939
_compute_nearest,
@@ -356,8 +356,6 @@ def _import_openmeeg(what="compute a BEM solution using OpenMEEG"):
356356
f"The OpenMEEG module must be installed to {what}, but "
357357
f'"import openmeeg" resulted in: {exc}'
358358
) from None
359-
if not _compare_version(om.__version__, ">=", "2.5.6"):
360-
raise ImportError(f"OpenMEEG 2.5.6+ is required, got {om.__version__}")
361359
return om
362360

363361

mne/conftest.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
_pl,
4545
_record_warnings,
4646
_TempDir,
47-
check_version,
4847
numerics,
4948
)
5049
from mne.viz._figure import use_browser_backend
@@ -667,11 +666,6 @@ def mpl_backend(garbage_collect):
667666
backend._close_all()
668667

669668

670-
# Skip functions or modules for mne-qt-browser < 0.2.0
671-
pre_2_0_skip_modules = ["mne.viz.tests.test_epochs", "mne.viz.tests.test_ica"]
672-
pre_2_0_skip_funcs = ["test_plot_raw_white", "test_plot_raw_selection"]
673-
674-
675669
def _check_pyqtgraph(request):
676670
# Check Qt
677671
qt_version, api = _check_qt_version(return_api=True)
@@ -681,17 +675,6 @@ def _check_pyqtgraph(request):
681675
)
682676
try:
683677
import mne_qt_browser # noqa: F401
684-
685-
# Check mne-qt-browser version
686-
lower_2_0 = _compare_version(mne_qt_browser.__version__, "<", "0.2.0")
687-
m_name = request.function.__module__
688-
f_name = request.function.__name__
689-
if lower_2_0 and m_name in pre_2_0_skip_modules:
690-
pytest.skip(
691-
f'Test-Module "{m_name}" was skipped for mne-qt-browser < 0.2.0'
692-
)
693-
elif lower_2_0 and f_name in pre_2_0_skip_funcs:
694-
pytest.skip(f'Test "{f_name}" was skipped for mne-qt-browser < 0.2.0')
695678
except Exception:
696679
pytest.skip("Requires mne_qt_browser")
697680

@@ -834,7 +817,7 @@ def _check_skip_backend(name):
834817
def pixel_ratio(qapp):
835818
"""Get the pixel ratio."""
836819
# _check_qt_version will init an app for us, so no need for us to do it
837-
if not check_version("pyvista", "0.32") or not _check_qt_version():
820+
if not _check_qt_version():
838821
return 1.0
839822
from qtpy.QtCore import Qt
840823
from qtpy.QtWidgets import QMainWindow

mne/decoding/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class LinearModel(MetaEstimatorMixin, BaseEstimator):
457457
"predict",
458458
"predict_proba",
459459
"predict_log_proba",
460-
"_estimator_type", # remove after sklearn 1.6
460+
"_estimator_type", # TODO VERSION remove on sklearn 1.6+
461461
"decision_function",
462462
"score",
463463
"classes_",
@@ -505,7 +505,7 @@ def _validate_params(self, X):
505505
"(classifier or regressor)"
506506
)
507507

508-
# For sklearn < 1.6
508+
# TODO VERSION remove on sklearn 1.6+
509509
try:
510510
self._check_n_features(X, reset=True)
511511
except AttributeError:

mne/decoding/search_light.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ def decision_function(self, X):
289289

290290
def _check_Xy(self, X, y=None, fit=False):
291291
"""Aux. function to check input data."""
292-
# Once we require sklearn 1.1+ we should do something like:
293292
X = self._check_data(X, y=y, atleast_3d=False, fit=fit)
294293
is_nd = X.ndim >= 3
295294
if not is_nd:

0 commit comments

Comments
 (0)