Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrnr committed Feb 24, 2025
1 parent d8b963f commit 0f82b9c
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 131 deletions.
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ The minimum required dependencies to run MNE-Python are:
- `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>`__ ≥ 0.3
- `packaging <https://packaging.pypa.io/en/stable/>`__

.. ↑↑↑ END CORE DEPS LIST. DO NOT EDIT! HANDLED BY PRE-COMMIT HOOK ↑↑↑
Expand Down
1 change: 0 additions & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"python>= 3.10",
"decorator",
"jinja2",
"lazy_loader >= 0.3",
"matplotlib >= 3.6",
"numpy >= 1.23,<3",
"packaging",
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies:
- jinja2
- joblib
- jupyter
- lazy_loader >=0.3
- mamba
- matplotlib >=3.7
- mffpy >=0.5.7
Expand Down
19 changes: 1 addition & 18 deletions mne/_fiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
51 changes: 0 additions & 51 deletions mne/preprocessing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
},
)
21 changes: 0 additions & 21 deletions mne/source_space/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
},
)
33 changes: 0 additions & 33 deletions mne/tests/test_import_nesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion mne/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,6 @@ def sys_info(
"# Infrastructure",
"decorator",
"jinja2",
# "lazy-loader",
"packaging",
"pooch",
"tqdm",
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion tools/environment_minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ dependencies:
- decorator
- packaging
- jinja2
- lazy_loader
1 change: 0 additions & 1 deletion tools/environment_old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ dependencies:
- decorator
- packaging
- jinja2
- lazy_loader =0.3
1 change: 0 additions & 1 deletion tools/hooks/sync_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
}

Expand Down

0 comments on commit 0f82b9c

Please sign in to comment.