Repository: mne-tools/mne-bids

Issue:
MAINT: MNE-Python now uses edfio instead of EDFlib-Python
https://github.com/mne-tools/mne-python/pull/12218

we thus need to adjust in mne-bids dependencies as well.


Discussion:

Resolving patch:
diff --git a/examples/anonymize_dataset.py b/examples/anonymize_dataset.py
--- a/examples/anonymize_dataset.py
+++ b/examples/anonymize_dataset.py
@@ -211,7 +211,7 @@
 #    anonymize the entire dataset again.
 
 for i in range(2):
-    print(f"\n\nRun {i+1}\n")
+    print(f"\n\nRun {i + 1}\n")
     shutil.rmtree(bids_root_anon)
     anonymize_dataset(
         bids_root_in=bids_root,
diff --git a/mne_bids/copyfiles.py b/mne_bids/copyfiles.py
--- a/mne_bids/copyfiles.py
+++ b/mne_bids/copyfiles.py
@@ -20,10 +20,8 @@
 import re
 import shutil as sh
 
-import mne
 from mne.io import read_raw_brainvision, read_raw_edf, read_raw_bdf, anonymize_info
 from mne.utils import logger, verbose
-from mne.fixes import _compare_version
 import numpy as np
 from scipy.io import loadmat, savemat
 
@@ -617,14 +615,6 @@ def copyfile_bti(raw, dest):
     copyfile_kit
 
     """
-    # XXX: remove after support for mne<1.5 is dropped
-    # BTi operations were unreliable in mne-bids prior to mne 1.5 / mne-bids 0.13
-    need_mne = "1.4.2"
-    if not _compare_version(mne.__version__, ">", need_mne):  # pragma: no cover
-        raise ImportError(
-            f"mne > {need_mne} is required for BTi operations, got {mne.__version__}"
-        )
-
     os.makedirs(dest, exist_ok=True)
     for key, val in (
         ("pdf_fname", None),


Test patch:
diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml
--- a/.github/workflows/unit_tests.yml
+++ b/.github/workflows/unit_tests.yml
@@ -21,7 +21,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ["3.11"]
+        python-version: ["3.12"]
     steps:
     - uses: actions/checkout@v4
     - uses: psf/black@stable
@@ -50,7 +50,7 @@ jobs:
       fail-fast: false
       matrix:
         os: [ubuntu-latest]
-        python-version: ["3.8", "3.11"]  # Oldest and newest supported versions
+        python-version: ["3.9", "3.12"]  # Oldest and newest supported versions
     steps:
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
@@ -107,15 +107,26 @@ jobs:
         python -c 'import matplotlib; print(matplotlib.__version__)'
         python -c 'import pandas; print(pandas.__version__)'
         python -c 'import EDFlib; print("EDFlib has no .__version__")'
+        python -c 'import edfio; print(edfio.__version__)'
 
   test:
+    # For GitHub "required" CI checks, add in branch protection:
+    # 6 checks:
+    # for each OS (ubuntu, macos, windows):
+    # 3.9 -> stable / full / stable
+    # 3.12 -> stable / full / stable
+    #
+    # 3 additional checks:
+    # ubuntu / 3.12 / main / full / main
+    # ubuntu / 3.9 / prev / full / stable
+    # ubuntu / 3.12 / stable / minimal / stable
     timeout-minutes: 60
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: ["3.8", "3.11"]  # Oldest and newest supported versions
+        python-version: ["3.9", "3.12"]  # Oldest and newest supported versions
         mne-version: [mne-stable]
         mne-bids-install: [full]
         bids-validator-version: [validator-stable]
@@ -124,19 +135,19 @@ jobs:
           # special test runs running only on single CI systems to save resources
           # Test development versions
           - os: ubuntu-latest
-            python-version: "3.11"
+            python-version: "3.12"
             mne-version: mne-main
             mne-bids-install: full
             bids-validator-version: validator-main
           # Test previous MNE stable version
           - os: ubuntu-latest
-            python-version: "3.8"
+            python-version: "3.9"
             mne-version: mne-prev-stable
             mne-bids-install: full
             bids-validator-version: validator-stable
           # Test minimal mne-bids install
           - os: ubuntu-latest
-            python-version: "3.11"
+            python-version: "3.12"
             mne-version: mne-stable
             mne-bids-install: minimal
             bids-validator-version: validator-stable
@@ -170,31 +181,31 @@ jobs:
         python -m pip install --upgrade -r test_requirements.txt
 
     - name: Install MNE (stable)
-      if: "matrix.mne-version == 'mne-stable'"
+      if: matrix.mne-version == 'mne-stable'
       run: |
-        git clone --single-branch --branch maint/1.5 https://github.com/mne-tools/mne-python.git
+        git clone --single-branch --branch maint/1.6 https://github.com/mne-tools/mne-python.git
         python -m pip install -e ./mne-python
 
     - name: Install MNE (previous stable)
-      if: "matrix.mne-version == 'mne-prev-stable'"
+      if: matrix.mne-version == 'mne-prev-stable'
       run: |
-        git clone --single-branch --branch maint/1.4 https://github.com/mne-tools/mne-python.git
+        git clone --single-branch --branch maint/1.5 https://github.com/mne-tools/mne-python.git
         python -m pip install -e ./mne-python
 
     - name: Install MNE (main)
-      if: "matrix.mne-version == 'mne-main'"
+      if: matrix.mne-version == 'mne-main'
       run: |
         git clone --single-branch --branch main https://github.com/mne-tools/mne-python.git
         python -m pip install -e ./mne-python
 
     - name: Install BIDS validator (stable)
-      if: "matrix.bids-validator-version == 'validator-stable'"
+      if: matrix.bids-validator-version == 'validator-stable'
       run: |
         npm install -g bids-validator
         echo "BIDS_VALIDATOR_BRANCH=stable" >> $GITHUB_ENV
 
     - name: Download BIDS validator (main)
-      if: "matrix.bids-validator-version == 'validator-main'"
+      if: matrix.bids-validator-version == 'validator-main'
       run: |
         pushd ..
         git clone --depth 1 https://github.com/bids-standard/bids-validator
@@ -202,7 +213,7 @@ jobs:
         echo "BIDS_VALIDATOR_BRANCH=main" >> $GITHUB_ENV
 
     - name: Install BIDS validator (main)
-      if: "matrix.bids-validator-version == 'validator-main'"
+      if: matrix.bids-validator-version == 'validator-main'
       run: |
         pushd ..
         cd bids-validator
@@ -228,17 +239,17 @@ jobs:
         mne sys_info
 
     - name: Install MNE-BIDS (minimal)
-      if: "matrix.mne-bids-install == 'minimal'"
+      if: matrix.mne-bids-install == 'minimal'
       run: python -m pip install -e .
 
     - name: Install MNE-BIDS (full)
-      if: "matrix.mne-bids-install == 'full'"
+      if: matrix.mne-bids-install == 'full'
       run: python -m pip install -e .[full]
 
     # Only run on a limited set of jobs
     - name: Run pytest without testing data
       run: make test
-      if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.mne-version == 'mne-main' }}
+      if: ${{ matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' && matrix.mne-version == 'mne-main' }}
 
     # Get testing data
     - run: ./tools/get_testing_version.sh
diff --git a/mne_bids/tests/test_copyfiles.py b/mne_bids/tests/test_copyfiles.py
--- a/mne_bids/tests/test_copyfiles.py
+++ b/mne_bids/tests/test_copyfiles.py
@@ -306,7 +306,6 @@ def test_copyfile_kit(tmp_path):
 @testing.requires_testing_data
 def test_copyfile_bti(tmp_path, dataset):
     """Test copying and renaming BTi files to a new location."""
-    pytest.importorskip("mne", "1.5.0.dev")  # XXX: remove when mne<1.5 is dropped
     pdf_fname = testing_path / "BTi" / dataset / "c,rfDC"
     kwargs = dict(head_shape_fname=None) if dataset == "erm_HFH" else dict()
     raw = mne.io.read_raw_bti(pdf_fname, **kwargs, verbose=False)
diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py
--- a/mne_bids/tests/test_write.py
+++ b/mne_bids/tests/test_write.py
@@ -1207,7 +1207,6 @@ def test_ctf(_bids_validate, tmp_path):
 @pytest.mark.filterwarnings(warning_str["channel_unit_changed"])
 def test_bti(_bids_validate, tmp_path, dataset):
     """Test functionality of the write_raw_bids conversion for BTi data."""
-    pytest.importorskip("mne", "1.5.0.dev")  # XXX: remove when mne<1.5 is dropped
     if dataset == "inbuilt_linux":
         bti_path = op.join(base_path, "bti", "tests", "data")
         pdf_fname = op.join(bti_path, "test_pdf_linux")
diff --git a/test_requirements.txt b/test_requirements.txt
--- a/test_requirements.txt
+++ b/test_requirements.txt
@@ -1,13 +1,14 @@
-mne>=1.4
-numpy>=1.20.2
-scipy>=1.6.3
+mne>=1.5
+numpy>=1.21.2
+scipy>=1.7.1
 nibabel>=3.2.1
 pybv>=0.7.5
 eeglabio>=0.0.2
 pymatreader>=0.0.30
-matplotlib>=3.4.0
-pandas>=1.2.4
-EDFlib-Python>=1.0.6
+matplotlib>=3.5.0
+pandas>=1.3.2
+EDFlib-Python>=1.0.6  # drop once mne <1.7 is no longer supported
+edfio >= 0.2.1
 pytest
 pytest-cov
 pytest-sugar