Skip to content

Commit 3b3f3af

Browse files
mne-botautofix-ci[bot]larsoner
authored
MAINT: Update dependency specifiers (#13916)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
1 parent 9f28e5f commit 3b3f3af

17 files changed

Lines changed: 44 additions & 57 deletions

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The minimum required dependencies to run MNE-Python are:
7575
- `Python <https://www.python.org>`__ ≥ 3.10
7676
- `NumPy <https://numpy.org>`__ ≥ 1.26
7777
- `SciPy <https://scipy.org>`__ ≥ 1.13
78-
- `Matplotlib <https://matplotlib.org>`__ ≥ 3.8
78+
- `Matplotlib <https://matplotlib.org>`__ ≥ 3.9
7979
- `Pooch <https://www.fatiando.org/pooch/latest/>`__ ≥ 1.5
8080
- `tqdm <https://tqdm.github.io>`__ ≥ 4.66
8181
- `Jinja2 <https://palletsprojects.com/p/jinja/>`__ ≥ 3.1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Updated minimum for:
2+
3+
- Optional dependency ``scikit-learn >= 1.5``
4+
5+
Changes implemented via CI action created by `Thomas Binns`_.

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies:
5353
- pyvistaqt >=0.11
5454
- qdarkstyle !=3.2.2
5555
- qtpy
56-
- scikit-learn >=1.4
56+
- scikit-learn >=1.5
5757
- scipy >=1.13
5858
- sip
5959
- snirf

mne/_fiff/proc_history.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Copyright the MNE-Python contributors.
44

55
import numpy as np
6+
from scipy.sparse import csc_array
67

7-
from ..fixes import _csc_array_cast
88
from ..utils import _check_fname, warn
99
from .constants import FIFF
1010
from .open import fiff_open, read_tag
@@ -211,7 +211,7 @@ def _write_proc_history(fid, info):
211211
FIFF.FIFF_DECOUPLER_MATRIX,
212212
)
213213
_sss_ctc_writers = (write_id, write_int, write_string, write_float_sparse)
214-
_sss_ctc_casters = (dict, np.array, str, _csc_array_cast)
214+
_sss_ctc_casters = (dict, np.array, str, csc_array)
215215

216216
_sss_cal_keys = ("cal_chans", "cal_corrs")
217217
_sss_cal_ids = (FIFF.FIFF_SSS_CAL_CHANS, FIFF.FIFF_SSS_CAL_CORRS)

mne/decoding/tests/test_csp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def test_csp_component_ordering():
499499
@parametrize_with_checks([CSP(), SPoC()])
500500
def test_sklearn_compliance(estimator, check):
501501
"""Test compliance with sklearn."""
502-
pytest.importorskip("sklearn", minversion="1.5") # TODO VERSION remove on 1.5+
502+
pytest.importorskip("sklearn", minversion="1.6") # TODO VERSION remove on 1.6+
503503
check(estimator)
504504

505505

mne/decoding/transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _check_data(
4444
if isinstance(epochs_data, BaseEpochs):
4545
epochs_data = epochs_data.get_data(copy=False)
4646
kwargs = dict(dtype=np.float64, allow_nd=True, order="C")
47-
if check_version("sklearn", "1.5"): # TODO VERSION sklearn 1.5+
47+
if check_version("sklearn", "1.6"): # TODO VERSION sklearn 1.6+
4848
kwargs["force_writeable"] = True
4949
if hasattr(self, "n_features_in_") and check_n_features:
5050
if y is None:

mne/fixes.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,6 @@ def _safe_svd(A, **kwargs):
136136
return linalg.svd(A, lapack_driver="gesvd", **kwargs)
137137

138138

139-
def _csc_array_cast(x):
140-
from scipy.sparse import csc_array
141-
142-
return csc_array(x)
143-
144-
145-
# Can be replaced with sparse.eye_array once we depend on SciPy >= 1.12
146-
def _eye_array(n, *, format="csr"): # noqa: A002
147-
from scipy import sparse
148-
149-
return sparse.dia_array((np.ones(n), 0), shape=(n, n)).asformat(format)
150-
151-
152139
###############################################################################
153140
# NumPy Generator (NumPy 1.17)
154141

@@ -707,7 +694,7 @@ def _close_event(fig):
707694

708695

709696
###############################################################################
710-
# SciPy 1.14+ minimum_phase half=True option
697+
# TODO VERSION SciPy 1.14+ minimum_phase half=True option
711698

712699

713700
def minimum_phase(h, method="homomorphic", n_fft=None, *, half=True):
@@ -778,8 +765,7 @@ def sph_harm_y(n, m, theta, phi, *, diff_n=0):
778765

779766

780767
###############################################################################
781-
# TODO VERSION: Can be removed once pymatreader >= 1.2.2 is the minimum
782-
# supported version.
768+
# TODO VERSION: Can be removed once pymatreader >= 1.2.2 is the min version
783769

784770

785771
def _whosmat(fname):
@@ -898,6 +884,8 @@ def _whosmat_hdf5(fname):
898884
# workaround: Numpy won't allow to read from file-like objects with numpy.fromfile,
899885
# we try to use numpy.fromfile, if a blob is used we use numpy.frombuffer to read
900886
# from the file-like object.
887+
888+
901889
def read_from_file_or_buffer(
902890
file: str | bytes | os.PathLike | io.IOBase,
903891
dtype: numpy.typing.DTypeLike = float,

mne/morph.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import numpy as np
1010
from scipy import sparse
1111

12-
from .fixes import _eye_array, _get_img_fdata, _reshape_view
12+
from .fixes import _get_img_fdata, _reshape_view
1313
from .morph_map import read_morph_map
1414
from .parallel import parallel_func
1515
from .source_estimate import (
@@ -1231,7 +1231,7 @@ def _hemi_morph(tris, vertices_to, vertices_from, smooth, maps, warn):
12311231
e = mesh_edges(tris)
12321232
e.data[e.data == 2] = 1
12331233
n_vertices = e.shape[0]
1234-
e += _eye_array(n_vertices, format="csr")
1234+
e += sparse.eye_array(n_vertices, format="csr")
12351235
if isinstance(smooth, str):
12361236
_check_option("smooth", smooth, ("nearest",), extra=" when used as a string.")
12371237
mm = _surf_nearest(vertices_from, e).tocsr()
@@ -1380,7 +1380,7 @@ def _surf_upsampling_mat(idx_from, e, smooth):
13801380
assert e.shape == (n_tot, n_tot)
13811381
# our output matrix starts out as a smaller matrix, and will gradually
13821382
# increase in size
1383-
data = _eye_array(len(idx_from), format="csr")
1383+
data = sparse.eye_array(len(idx_from), format="csr")
13841384
_validate_type(smooth, ("int-like", str, None), "smoothing steps")
13851385
if smooth is not None: # number of steps
13861386
smooth = _ensure_int(smooth, "smoothing steps")

mne/morph_map.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99

1010
import numpy as np
11-
from scipy.sparse import csr_array
11+
from scipy.sparse import csr_array, eye_array
1212

1313
from ._fiff.constants import FIFF
1414
from ._fiff.open import fiff_open
@@ -22,7 +22,6 @@
2222
write_int,
2323
write_string,
2424
)
25-
from .fixes import _eye_array
2625
from .surface import (
2726
_compute_nearest,
2827
_find_nearest_tri_pts,
@@ -210,7 +209,7 @@ def _make_morph_map_hemi(subject_from, subject_to, subjects_dir, reg_from, reg_t
210209
if subject_from == subject_to and reg_from == reg_to:
211210
fname = subjects_dir / subject_from / "surf" / reg_from
212211
n_pts = len(read_surface(fname, verbose=False)[0])
213-
return _eye_array(n_pts, format="csr")
212+
return eye_array(n_pts, format="csr")
214213

215214
# load surfaces and normalize points to be on unit sphere
216215
fname = subjects_dir / subject_from / "surf" / reg_from

mne/source_estimate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .cov import Covariance
2020
from .evoked import _get_peak
2121
from .filter import FilterMixin, _check_fun, resample
22-
from .fixes import _eye_array, _reshape_view, _safe_svd
22+
from .fixes import _reshape_view, _safe_svd
2323
from .parallel import parallel_func
2424
from .source_space._source_space import (
2525
SourceSpaces,
@@ -3188,7 +3188,7 @@ def spatio_temporal_tris_adjacency(tris, n_times, remap_vertices=False, verbose=
31883188
tris = np.searchsorted(np.unique(tris), tris)
31893189

31903190
edges = mesh_edges(tris)
3191-
edges = (edges + _eye_array(edges.shape[0])).tocoo()
3191+
edges = (edges + sparse.eye_array(edges.shape[0], format="csr")).tocoo()
31923192
return _get_adjacency_from_edges(edges, n_times)
31933193

31943194

0 commit comments

Comments
 (0)