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

Revert lazy loading (importing) packages #13124

Draft
wants to merge 48 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0c504b7
Revert "handle lazy loading through .pyi type stubs (#12072)"
cbrnr Feb 23, 2025
1f00b19
Revert "ENH: use lazy loading (#11838)"
cbrnr Feb 23, 2025
7bafe87
ruff
cbrnr Feb 23, 2025
b4426cc
Style
cbrnr Feb 23, 2025
fb2676e
Various fixes
cbrnr Feb 23, 2025
269e0d3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
d8b963f
Fix ruff errors
cbrnr Feb 24, 2025
0f82b9c
More fixes
cbrnr Feb 24, 2025
bb7ac08
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
c4222a9
More fixes
cbrnr Feb 24, 2025
edafe19
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
70f8d34
gui fixes
cbrnr Feb 24, 2025
255531a
More gui
cbrnr Feb 24, 2025
0c5ed99
Add missing file
cbrnr Feb 24, 2025
2c0026f
More fixes
cbrnr Feb 24, 2025
ed67948
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
4b55795
Even more
cbrnr Feb 24, 2025
e84e5e3
Revert
cbrnr Feb 24, 2025
305cd63
Undelete
cbrnr Feb 24, 2025
a992cd2
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 24, 2025
3402942
Remove script
cbrnr Feb 24, 2025
e77340d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
325213a
Add missing imports
cbrnr Feb 24, 2025
6599745
Fix imports
cbrnr Feb 24, 2025
107948c
Nest SciPy
cbrnr Feb 24, 2025
7799c20
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 24, 2025
71c345e
Remove lazy-loader core dep (temporary fix)
cbrnr Feb 25, 2025
1a007bb
Do not export xdawn
cbrnr Feb 25, 2025
a279410
Export source_space
cbrnr Feb 25, 2025
753f92a
Explicit source_space exports
cbrnr Feb 25, 2025
5bd359d
More explicit exports
cbrnr Feb 25, 2025
f563516
More
cbrnr Feb 25, 2025
aa5cd17
Export BaseTFR
cbrnr Feb 25, 2025
4406c5b
Fix fft
cbrnr Feb 25, 2025
d800621
Remove public exports
cbrnr Feb 25, 2025
ffad545
Add __all__
cbrnr Feb 25, 2025
1fb130e
Add missing submodules
cbrnr Feb 26, 2025
af1ddcd
Merge branch 'main' into revert-lazyloader
cbrnr Feb 26, 2025
2c90634
Fix import nesting test
cbrnr Feb 26, 2025
5e2f83c
Revert
cbrnr Feb 26, 2025
d2c5d80
Adjust nesting test
cbrnr Feb 27, 2025
fb63ce4
Merge branch 'main' into revert-lazyloader
cbrnr Feb 27, 2025
7843ad5
Add missing export
cbrnr Feb 27, 2025
ae518da
csr_matrix -> csr_array
cbrnr Feb 27, 2025
50bc4e0
Fix csr_array
cbrnr Feb 27, 2025
27db5fb
Add more missing exports
cbrnr Feb 27, 2025
a21a1a1
More missing exports
cbrnr Feb 27, 2025
6fed24e
Use minimum_phase from fixes
cbrnr Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
219 changes: 214 additions & 5 deletions mne/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Copyright the MNE-Python contributors.

"""MNE software for MEG and EEG data analysis."""

# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
Expand All @@ -17,8 +18,6 @@
# X.Y # Final release
#
# Dev branch marker is: 'X.Y.devN' where N is an integer.
#
import lazy_loader as lazy

try:
from importlib.metadata import version
Expand All @@ -27,10 +26,220 @@
except Exception:
__version__ = "0.0.0"

(__getattr__, __dir__, __all__) = lazy.attach_stub(__name__, __file__)
# have to import verbose first since it's needed by many things
from .utils import (
set_log_level,
set_log_file,
verbose,
set_config,
get_config,
get_config_path,
set_cache_dir,
set_memmap_min_size,
grand_average,
sys_info,
open_docs,
use_log_level,
)
from ._fiff.pick import (
pick_types,
pick_channels,
pick_channels_regexp,
pick_channels_forward,
pick_types_forward,
pick_channels_cov,
pick_info,
channel_type,
channel_indices_by_type,
)
from .io.base import concatenate_raws, match_channel_orders
from ._fiff.meas_info import create_info, Info
from ._fiff.proj import Projection
from .io.kit import read_epochs_kit
from .io.eeglab import read_epochs_eeglab
from ._fiff.reference import (
set_eeg_reference,
set_bipolar_reference,
add_reference_channels,
)
from ._fiff.what import what
from .bem import (
make_sphere_model,
make_bem_model,
make_bem_solution,
read_bem_surfaces,
write_bem_surfaces,
write_head_bem,
read_bem_solution,
write_bem_solution,
)
from .cov import (
read_cov,
write_cov,
Covariance,
compute_raw_covariance,
compute_covariance,
whiten_evoked,
make_ad_hoc_cov,
)
from .event import (
read_events,
write_events,
find_events,
merge_events,
pick_events,
make_fixed_length_events,
concatenate_events,
find_stim_steps,
AcqParserFIF,
count_events,
)
from ._freesurfer import (
head_to_mni,
head_to_mri,
read_talxfm,
get_volume_labels_from_aseg,
read_freesurfer_lut,
vertex_to_mni,
read_lta,
)
from .forward import (
read_forward_solution,
apply_forward,
apply_forward_raw,
average_forward_solutions,
Forward,
write_forward_solution,
make_forward_solution,
convert_forward_solution,
make_field_map,
make_forward_dipole,
use_coil_def,
)
from .source_estimate import (
read_source_estimate,
SourceEstimate,
VectorSourceEstimate,
VolSourceEstimate,
VolVectorSourceEstimate,
MixedSourceEstimate,
MixedVectorSourceEstimate,
grade_to_tris,
spatial_src_adjacency,
spatial_tris_adjacency,
spatial_dist_adjacency,
spatial_inter_hemi_adjacency,
spatio_temporal_src_adjacency,
spatio_temporal_tris_adjacency,
spatio_temporal_dist_adjacency,
extract_label_time_course,
stc_near_sensors,
)
from .surface import (
read_surface,
write_surface,
decimate_surface,
read_tri,
get_head_surf,
get_meg_helmet_surf,
dig_mri_distances,
get_montage_volume_labels,
)
from .morph_map import read_morph_map
from .morph import (
SourceMorph,
read_source_morph,
grade_to_vertices,
compute_source_morph,
)
from .annotations import (
Annotations,
read_annotations,
annotations_from_events,
events_from_annotations,
count_annotations,
)
from .epochs import (
BaseEpochs,
Epochs,
EpochsArray,
read_epochs,
concatenate_epochs,
make_fixed_length_epochs,
)
from .evoked import Evoked, EvokedArray, read_evokeds, write_evokeds, combine_evoked
from .label import (
read_label,
label_sign_flip,
write_label,
stc_to_label,
grow_labels,
Label,
split_label,
BiHemiLabel,
read_labels_from_annot,
write_labels_to_annot,
random_parcellation,
morph_labels,
labels_to_stc,
)
from .misc import parse_config, read_reject_parameters
from .coreg import (
create_default_subject,
scale_bem,
scale_mri,
scale_labels,
scale_source_space,
)
from .transforms import read_trans, write_trans, transform_surface_to, Transform
from .proj import (
read_proj,
write_proj,
compute_proj_epochs,
compute_proj_evoked,
compute_proj_raw,
sensitivity_map,
)
from .dipole import read_dipole, Dipole, DipoleFixed, fit_dipole
from .channels import (
equalize_channels,
rename_channels,
find_layout,
read_vectorview_selection,
)
from .report import Report, open_report

# initialize logging
from .utils import set_log_level, set_log_file
from .io import (
read_epochs_fieldtrip,
read_evoked_besa,
read_evoked_fieldtrip,
read_evokeds_mff,
)
from .rank import compute_rank

from . import beamformer
from . import channels
from . import chpi
from . import commands
from . import coreg
from . import cuda
from . import datasets
from . import dipole
from . import epochs
from . import event
from . import io
from . import filter
from . import gui
from . import inverse_sparse
from . import minimum_norm
from . import preprocessing
from . import simulation
from . import stats
from . import surface
from . import time_frequency
from . import viz
from . import export

# initialize logging
set_log_level(None, False)
set_log_file()
Loading
Loading