From 52a905928d43703f96517b7050f524e5a653a079 Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Wed, 17 Jan 2024 04:51:35 +0100 Subject: [PATCH] Add Python 3.12 (#12361) Co-authored-by: Eric Larson --- .github/workflows/tests.yml | 14 ++++++++++---- doc/conf.py | 9 +++++++++ mne/conftest.py | 9 +++++++++ mne/export/_egimff.py | 3 +-- tools/github_actions_dependencies.sh | 2 +- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 85f537930a5..913aceea194 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,14 +55,14 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - python: '3.10' - kind: conda - os: ubuntu-latest python: '3.11' kind: pip-pre + - os: ubuntu-latest + python: '3.12' + kind: conda - os: macos-latest - python: '3.9' + python: '3.11' kind: mamba - os: windows-latest python: '3.10' @@ -89,6 +89,12 @@ jobs: python-version: ${{ matrix.python }} if: startswith(matrix.kind, 'pip') # Python (if conda) + - name: Remove numba and dipy + run: | # TODO: Remove when numba 0.59 and dipy 1.8 land on conda-forge + sed -i '/numba/d' environment.yml + sed -i '/dipy/d' environment.yml + sed -i 's/- mne$/- mne-base/' environment.yml + if: matrix.os == 'ubuntu-latest' && startswith(matrix.kind, 'conda') && matrix.python == '3.12' - uses: mamba-org/setup-micromamba@v1 with: environment-file: ${{ env.CONDA_ENV }} diff --git a/doc/conf.py b/doc/conf.py index d114237bd5a..5805f377983 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1335,6 +1335,15 @@ def reset_warnings(gallery_conf, fname): r"The .* was deprecated in Matplotlib 3\.7", # scipy r"scipy.signal.morlet2 is deprecated in SciPy 1\.12", + # Matplotlib->tz + r"datetime\.datetime\.utcfromtimestamp", + # joblib + r"ast\.Num is deprecated", + r"Attribute n is deprecated and will be removed in Python 3\.14", + # numpydoc + r"ast\.NameConstant is deprecated and will be removed in Python 3\.14", + # pooch + r"Python 3\.14 will, by default, filter extracted tar archives.*", ): warnings.filterwarnings( # deal with other modules having bad imports "ignore", message=".*%s.*" % key, category=DeprecationWarning diff --git a/mne/conftest.py b/mne/conftest.py index a693b702935..f41bfa1374c 100644 --- a/mne/conftest.py +++ b/mne/conftest.py @@ -187,6 +187,15 @@ def pytest_configure(config): ignore:Mesa version 10\.2\.4 is too old for translucent.*:RuntimeWarning # Matplotlib <-> NumPy 2.0 ignore:`row_stack` alias is deprecated.*:DeprecationWarning + # Matplotlib->tz + ignore:datetime.datetime.utcfromtimestamp.*:DeprecationWarning + # joblib + ignore:ast\.Num is deprecated.*:DeprecationWarning + ignore:Attribute n is deprecated and will be removed in Python 3\.14.*:DeprecationWarning + # numpydoc + ignore:ast\.NameConstant is deprecated and will be removed in Python 3\.14.*:DeprecationWarning + # pooch + ignore:Python 3\.14 will, by default, filter extracted tar archives.*:DeprecationWarning """ # noqa: E501 for warning_line in warning_lines.split("\n"): warning_line = warning_line.strip() diff --git a/mne/export/_egimff.py b/mne/export/_egimff.py index ef10c71acfc..70462a96841 100644 --- a/mne/export/_egimff.py +++ b/mne/export/_egimff.py @@ -50,7 +50,6 @@ def export_evokeds_mff(fname, evoked, history=None, *, overwrite=False, verbose= using MFF read functions. """ mffpy = _import_mffpy("Export evokeds to MFF.") - import pytz info = evoked[0].info if np.round(info["sfreq"]) != info["sfreq"]: @@ -73,7 +72,7 @@ def export_evokeds_mff(fname, evoked, history=None, *, overwrite=False, verbose= if op.exists(fname): os.remove(fname) if op.isfile(fname) else shutil.rmtree(fname) writer = mffpy.Writer(fname) - current_time = pytz.utc.localize(datetime.datetime.utcnow()) + current_time = datetime.datetime.now(datetime.timezone.utc) writer.addxml("fileInfo", recordTime=current_time) try: device = info["device_info"]["type"] diff --git a/tools/github_actions_dependencies.sh b/tools/github_actions_dependencies.sh index c56dd3d9ad0..4c4fb9eb3c2 100755 --- a/tools/github_actions_dependencies.sh +++ b/tools/github_actions_dependencies.sh @@ -7,7 +7,7 @@ INSTALL_ARGS="-e" INSTALL_KIND="test_extra,hdf5" if [ ! -z "$CONDA_ENV" ]; then echo "Uninstalling MNE for CONDA_ENV=${CONDA_ENV}" - conda remove -c conda-forge --force -yq mne + conda remove -c conda-forge --force -yq mne-base python -m pip uninstall -y mne if [[ "${RUNNER_OS}" != "Windows" ]]; then INSTALL_ARGS=""