diff --git a/README.rst b/README.rst index cfa7488324f..79717ee8b40 100644 --- a/README.rst +++ b/README.rst @@ -80,7 +80,6 @@ The minimum required dependencies to run MNE-Python are: - `tqdm `__ - `Jinja2 `__ - `decorator `__ -- `lazy-loader `__ ≥ 0.3 - `packaging `__ .. ↑↑↑ END CORE DEPS LIST. DO NOT EDIT! HANDLED BY PRE-COMMIT HOOK ↑↑↑ diff --git a/codemeta.json b/codemeta.json index d5ec88c23e9..5d6ff012a2a 100644 --- a/codemeta.json +++ b/codemeta.json @@ -40,7 +40,6 @@ "python>= 3.10", "decorator", "jinja2", - "lazy_loader >= 0.3", "matplotlib >= 3.6", "numpy >= 1.23,<3", "packaging", diff --git a/environment.yml b/environment.yml index 78c773e56bf..29abecd6e44 100644 --- a/environment.yml +++ b/environment.yml @@ -22,7 +22,6 @@ dependencies: - jinja2 - joblib - jupyter - - lazy_loader >=0.3 - mamba - matplotlib >=3.7 - mffpy >=0.5.7 diff --git a/mne/_fiff/__init__.py b/mne/_fiff/__init__.py index c9e95cab776..6d14d005fd4 100644 --- a/mne/_fiff/__init__.py +++ b/mne/_fiff/__init__.py @@ -5,21 +5,4 @@ # Copyright the MNE-Python contributors. # All imports should be done directly to submodules, so we don't import -# anything here - - -_dep_msg = ( - "is deprecated will be removed in 1.6, use documented public API instead. " - "If no appropriate public API exists, please open an issue on GitHub." -) - - -# Helper for keeping some attributes en mne/io/*.py -def _io_dep_getattr(name, mod): - import importlib - from ..utils import warn - - fiff_mod = importlib.import_module(f"mne._fiff.{mod}") - obj = getattr(fiff_mod, name) - warn(f"mne.io.{mod}.{name} {_dep_msg}", FutureWarning) - return obj +# anything here. diff --git a/mne/preprocessing/__init__.py b/mne/preprocessing/__init__.py index dbb77f99f23..cb58ea7ce76 100644 --- a/mne/preprocessing/__init__.py +++ b/mne/preprocessing/__init__.py @@ -4,54 +4,3 @@ # License: BSD-3-Clause # Copyright the MNE-Python contributors. -import lazy_loader as lazy - -__getattr__, __dir__, __all__ = lazy.attach( - __name__, - submodules=["eyetracking", "ieeg", "nirs"], - submod_attrs={ - "_annotate_amplitude": ["annotate_amplitude"], - "maxfilter": ["apply_maxfilter"], - "ssp": ["compute_proj_ecg", "compute_proj_eog"], - "eog": ["find_eog_events", "create_eog_epochs"], - "ecg": ["find_ecg_events", "create_ecg_epochs"], - "ica": [ - "ICA", - "ica_find_eog_events", - "ica_find_ecg_events", - "get_score_funcs", - "read_ica", - "corrmap", - "read_ica_eeglab", - ], - "otp": ["oversampled_temporal_projection"], - "_peak_finder": ["peak_finder"], - "infomax_": ["infomax"], - "stim": ["fix_stim_artifact"], - "maxwell": [ - "maxwell_filter", - "find_bad_channels_maxwell", - "compute_maxwell_basis", - "maxwell_filter_prepare_emptyroom", - ], - "realign": ["realign_raw"], - "xdawn": ["Xdawn"], - "_csd": ["compute_current_source_density", "compute_bridged_electrodes"], - "artifact_detection": [ - "annotate_movement", - "compute_average_dev_head_t", - "annotate_muscle_zscore", - "annotate_break", - ], - "_regress": ["regress_artifact", "EOGRegression", "read_eog_regression"], - "_fine_cal": [ - "compute_fine_calibration", - "read_fine_calibration", - "write_fine_calibration", - ], - "_annotate_nan": ["annotate_nan"], - "interpolate": ["equalize_bads", "interpolate_bridged_electrodes"], - "_css": ["cortical_signal_suppression"], - "hfc": ["compute_proj_hfc"], - }, -) diff --git a/mne/source_space/__init__.py b/mne/source_space/__init__.py index b55af4072e8..61c38ef4a44 100644 --- a/mne/source_space/__init__.py +++ b/mne/source_space/__init__.py @@ -3,24 +3,3 @@ # Copyright the MNE-Python contributors. """Forward modeling code.""" - -import lazy_loader as lazy - -__getattr__, __dir__, __all__ = lazy.attach( - __name__, - submodules=["_source_space"], - submod_attrs={ - "_source_space": [ - "compute_distance_to_sensors", - "get_decimated_surfaces", - # These are documented in the MNE namespace but it doesn't hurt to - # keep them here as well - "SourceSpaces", - "read_source_spaces", - "write_source_spaces", - "setup_source_space", - "setup_volume_source_space", - "add_source_space_distances", - ], - }, -) diff --git a/mne/tests/test_import_nesting.py b/mne/tests/test_import_nesting.py index 493ffccd680..39484e09b3b 100644 --- a/mne/tests/test_import_nesting.py +++ b/mne/tests/test_import_nesting.py @@ -223,39 +223,6 @@ def generic_visit(self, node): # scheme obeys the above order -# This test ensures that modules are lazily loaded by lazy_loader. - -eager_import = os.getenv("EAGER_IMPORT", "") -run_script = """ -import sys -import mne - -out = set() - -# check scipy (Numba imports it to check the version) -ok_scipy_submodules = {'version'} -scipy_submodules = set(x.split('.')[1] for x in sys.modules.keys() - if x.startswith('scipy.') and '__' not in x and - not x.split('.')[1].startswith('_') - and sys.modules[x] is not None) -bad = scipy_submodules - ok_scipy_submodules -if len(bad) > 0: - out |= {'scipy submodules: %s' % list(bad)} - -# check sklearn and others -for x in sys.modules.keys(): - for key in ('sklearn', 'pandas', 'pyvista', 'matplotlib', - 'dipy', 'nibabel', 'cupy', 'picard', 'pyvistaqt', 'pooch', - 'tqdm', 'jinja2'): - if x.startswith(key): - x = '.'.join(x.split('.')[:2]) - out |= {x} -if len(out) > 0: - print('\\nFound un-nested import(s) for %s' % (sorted(out),), end='') -exit(len(out)) -""" - - def test_module_nesting(): """Test that module imports are properly nested.""" stdout, stderr, code = run_subprocess( diff --git a/mne/utils/config.py b/mne/utils/config.py index c28373fcb93..3d0772b8136 100644 --- a/mne/utils/config.py +++ b/mne/utils/config.py @@ -790,7 +790,6 @@ def sys_info( "# Infrastructure", "decorator", "jinja2", - # "lazy-loader", "packaging", "pooch", "tqdm", diff --git a/pyproject.toml b/pyproject.toml index f20c495a2bc..620d95a8d1e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ classifiers = [ dependencies = [ "decorator", "jinja2", - "lazy_loader >= 0.3", "matplotlib >= 3.7", # 2023/02/13 "numpy >= 1.25,<3", # 2023/06/17 "packaging", diff --git a/tools/environment_minimal.yml b/tools/environment_minimal.yml index f67decbe0d2..147e938d73b 100644 --- a/tools/environment_minimal.yml +++ b/tools/environment_minimal.yml @@ -12,4 +12,3 @@ dependencies: - decorator - packaging - jinja2 - - lazy_loader diff --git a/tools/environment_old.yml b/tools/environment_old.yml index 46826bdbcf4..ddb1b51a231 100644 --- a/tools/environment_old.yml +++ b/tools/environment_old.yml @@ -15,4 +15,3 @@ dependencies: - decorator - packaging - jinja2 - - lazy_loader =0.3 diff --git a/tools/hooks/sync_dependencies.py b/tools/hooks/sync_dependencies.py index 1ff6d7f8712..db14274893e 100755 --- a/tools/hooks/sync_dependencies.py +++ b/tools/hooks/sync_dependencies.py @@ -28,7 +28,6 @@ "tqdm": "https://tqdm.github.io", "Jinja2": "https://palletsprojects.com/p/jinja/", "decorator": "https://github.com/micheles/decorator", - "lazy-loader": "https://pypi.org/project/lazy_loader", "packaging": "https://packaging.pypa.io/en/stable/", }