From 437fe0d4ab04eb5ed34863e39c8c91eb9c51324a Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Sun, 19 May 2024 12:48:31 +0200 Subject: [PATCH 1/7] fix pip syntax, add some ignores --- .gitignore | 2 ++ CONTRIBUTING.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b8d24ce2e..7c67eba78 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,11 @@ dist/ *.egg* build coverage +.coverage* *.xml .venv .ruff_cache +sg_execution_times.rst # Sphinx documentation doc/_build/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d716feaf9..bf93a8412 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ Then, `git clone` your fork and install it in "editable" mode. ```Shell git clone https://github.com//mne-bids cd ./mne-bids -pip install -e .[dev] +pip install -e ".[dev]" git config --local blame.ignoreRevsFile .git-blame-ignore-revs ``` From 23a14c7e427a4ea314e279e06b8f7007facc3e48 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Thu, 23 May 2024 08:14:29 +0200 Subject: [PATCH 2/7] fix syntax for osx in makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b2c475795..8430cc582 100755 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ clean-e: clean: clean-build clean-pyc clean-so clean-ctags clean-cache clean-e inplace: - @python -m pip install -e .[dev] + @python -m pip install -e ".[dev]" test: @echo "Running tests" From 71db82007a1097e6cde1c6d93f9501b6f38f5afa Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 28 May 2024 09:24:34 +0200 Subject: [PATCH 3/7] bump pre-commit hook https://github.com/mne-tools/mne-bids/pull/1256 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 626784d23..01c291b5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.4 + rev: v0.4.5 hooks: - id: ruff name: ruff mne_bids/ From b14d88c00c38569f25cf55c7aa6b365c6b802062 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 28 May 2024 09:29:48 +0200 Subject: [PATCH 4/7] fix broken mne import --- doc/sphinxext/gen_cli.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/sphinxext/gen_cli.py b/doc/sphinxext/gen_cli.py index d2a35c8f8..c3bab4c46 100644 --- a/doc/sphinxext/gen_cli.py +++ b/doc/sphinxext/gen_cli.py @@ -8,13 +8,14 @@ # Stefan Appelhoff # # License: BSD-3-Clause -import os import glob -from os import path as op +import os +import shutil import sys +from os import path as op import sphinx.util -from mne.utils import run_subprocess, _replace_md5 +from mne.utils import hashfunc, run_subprocess def setup(app): @@ -116,6 +117,17 @@ def generate_cli_rst(app=None): print("[Done]") +def _replace_md5(fname): + """Replace a file based on MD5sum.""" + # adapted from sphinx-gallery + assert fname.endswith(".new") + fname_old = fname[:-4] + if os.path.isfile(fname_old) and hashfunc(fname) == hashfunc(fname_old): + os.remove(fname) + else: + shutil.move(fname, fname_old) + + # This is useful for testing/iterating to see what the result looks like if __name__ == "__main__": generate_cli_rst() From 72b7dcda6160ce3391bac611af671c92ca95785c Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 28 May 2024 10:06:18 +0200 Subject: [PATCH 5/7] need to use .lower() for str comp --- mne_bids/inspect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/inspect.py b/mne_bids/inspect.py index 45fd33e20..5cd5bd803 100644 --- a/mne_bids/inspect.py +++ b/mne_bids/inspect.py @@ -208,7 +208,7 @@ def _keypress_callback(event): onset=[], duration=[], description=[], orig_time=raw.info["meas_date"] ) - if matplotlib.get_backend() != "agg": + if matplotlib.get_backend().lower() != "agg": plt.show(block=True) _global_vars["raw_fig"] = fig From fbda47fa17a3d077d1a1bdef17fe3f7326b85766 Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 28 May 2024 10:17:43 +0200 Subject: [PATCH 6/7] missed one str comp --- mne_bids/inspect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne_bids/inspect.py b/mne_bids/inspect.py index 5cd5bd803..9106cfbe2 100644 --- a/mne_bids/inspect.py +++ b/mne_bids/inspect.py @@ -430,7 +430,7 @@ def _keypress_callback(event): fig.canvas.mpl_connect("close_event", _dont_save_callback) fig.canvas.mpl_connect("key_press_event", _keypress_callback) - if matplotlib.get_backend() != "agg": + if matplotlib.get_backend().lower() != "agg": fig.show() _global_vars["dialog_fig"] = fig From 7068f792580e03ffac22fd5631d2b71023f7a6ce Mon Sep 17 00:00:00 2001 From: Stefan Appelhoff Date: Tue, 28 May 2024 10:33:33 +0200 Subject: [PATCH 7/7] Agg -> agg --- mne_bids/tests/test_inspect.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mne_bids/tests/test_inspect.py b/mne_bids/tests/test_inspect.py index 2d746aae7..b80a4399a 100644 --- a/mne_bids/tests/test_inspect.py +++ b/mne_bids/tests/test_inspect.py @@ -71,7 +71,7 @@ def test_inspect_single_file(tmp_path, save_changes): import matplotlib.pyplot as plt from mne.utils._testing import _click_ch_name - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -115,7 +115,7 @@ def test_inspect_multiple_files(tmp_path): matplotlib = pytest.importorskip("matplotlib") import matplotlib.pyplot as plt - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -143,7 +143,7 @@ def test_inspect_set_and_unset_bads(tmp_path): import matplotlib.pyplot as plt from mne.utils._testing import _click_ch_name - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -217,7 +217,7 @@ def test_inspect_annotations(tmp_path): matplotlib = pytest.importorskip("matplotlib") import matplotlib.pyplot as plt - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -273,7 +273,7 @@ def test_inspect_annotations_remove_all(tmp_path): matplotlib = pytest.importorskip("matplotlib") import matplotlib.pyplot as plt - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -332,7 +332,7 @@ def test_inspect_dont_show_annotations(tmp_path): matplotlib = pytest.importorskip("matplotlib") import matplotlib.pyplot as plt - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -350,7 +350,7 @@ def test_inspect_bads_and_annotations(tmp_path): import matplotlib.pyplot as plt from mne.utils._testing import _click_ch_name - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path) @@ -391,7 +391,7 @@ def test_inspect_auto_flats(tmp_path, save_changes): matplotlib = pytest.importorskip("matplotlib") import matplotlib.pyplot as plt - matplotlib.use("Agg") + matplotlib.use("agg") plt.close("all") bids_root = setup_bids_test_dir(tmp_path)