From 2c602a283f444bddc61bca07f360d0d7777b6dd4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 2 Nov 2023 10:52:02 -0400 Subject: [PATCH 1/3] MAINT: Add rstcheck to CIs and pre-commit --- .pre-commit-config.yaml | 10 ++++++++++ doc/_includes/dig_formats.rst | 1 + doc/development/contributing.rst | 2 ++ doc/documentation/design_philosophy.rst | 2 ++ doc/documentation/index.rst | 2 ++ doc/install/mne_tools_suite.rst | 2 ++ pyproject.toml | 14 ++++++++++++++ tools/azure_dependencies.sh | 2 +- tools/github_actions_dependencies.sh | 2 +- 9 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4ec4cd6c62..6ff357ca832 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,3 +41,13 @@ repos: hooks: - id: yamllint args: [--strict, -c, .yamllint.yml] + + # rstcheck + - repo: https://github.com/rstcheck/rstcheck.git + rev: v6.2.0 + hooks: + - id: rstcheck + files: ^doc/.*\.(rst|inc)$ + # https://github.com/rstcheck/rstcheck/issues/199 + # https://github.com/rstcheck/rstcheck/issues/200 + exclude: ^doc/(help/faq|install/manual_install|install/mne_c|install/advanced|install/updating|_includes/channel_interpolation|_includes/inverse|_includes/ssp)\.rst$ diff --git a/doc/_includes/dig_formats.rst b/doc/_includes/dig_formats.rst index c2d3fde4c27..5928b081aea 100644 --- a/doc/_includes/dig_formats.rst +++ b/doc/_includes/dig_formats.rst @@ -1,4 +1,5 @@ :orphan: + .. _dig-formats: Supported formats for digitized 3D locations diff --git a/doc/development/contributing.rst b/doc/development/contributing.rst index f5194cb688d..2dbf90d306b 100644 --- a/doc/development/contributing.rst +++ b/doc/development/contributing.rst @@ -1111,3 +1111,5 @@ it can serve as a useful example of what to expect from the PR review process. .. _optipng: http://optipng.sourceforge.net/ .. _optipng for Windows: http://prdownloads.sourceforge.net/optipng/optipng-0.7.7-win32.zip?download + +.. include:: ../links.inc diff --git a/doc/documentation/design_philosophy.rst b/doc/documentation/design_philosophy.rst index af43f630aa1..5bdec09b4fa 100644 --- a/doc/documentation/design_philosophy.rst +++ b/doc/documentation/design_philosophy.rst @@ -94,3 +94,5 @@ of data. .. LINKS .. _`method chaining`: https://en.wikipedia.org/wiki/Method_chaining + +.. include:: ../links.inc diff --git a/doc/documentation/index.rst b/doc/documentation/index.rst index 6830edff012..764fcd08188 100644 --- a/doc/documentation/index.rst +++ b/doc/documentation/index.rst @@ -59,3 +59,5 @@ Documentation for the related C and MATLAB tools are available here: cookbook cite cited + +.. include:: ../links.inc diff --git a/doc/install/mne_tools_suite.rst b/doc/install/mne_tools_suite.rst index 579e3c77c08..03b65671826 100644 --- a/doc/install/mne_tools_suite.rst +++ b/doc/install/mne_tools_suite.rst @@ -112,3 +112,5 @@ Help with installation is available through the `MNE Forum`_. See the .. _invertmeeg: https://github.com/LukeTheHecker/invert .. _MNE-ARI: https://github.com/john-veillette/mne_ari .. _niseq: https://github.com/john-veillette/niseq + +.. include:: ../links.inc diff --git a/pyproject.toml b/pyproject.toml index 0dc29069335..f28204f5bca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,3 +140,17 @@ exclude = "(dist/)|(build/)|(.*\\.ipynb)" [tool.bandit.assert_used] skips = ["*/test_*.py"] # assert statements are good practice with pytest + +[tool.rstcheck] +report_level = "WARNING" +ignore_roles = [ + "func", "class", "term", "ref", "doc", "gh", "file", "samp", "meth", "mod", "kbd", + "newcontrib", "footcite", "footcite:t", "eq", "py:mod", "attr", "py:class", "exc", +] +ignore_directives = [ + "rst-class", "tab-set", "grid", "toctree", "footbibliography", "autosummary", + "currentmodule", "automodule", "cssclass", "tabularcolumns", "minigallery", + "autoclass", "highlight", "dropdown", "graphviz", "glossary", "autofunction", + "bibliography", +] +ignore_messages = "^.*(Unknown target name|Undefined substitution referenced)[^`]*$" diff --git a/tools/azure_dependencies.sh b/tools/azure_dependencies.sh index 5cf455cf4f4..d3ce1a98119 100755 --- a/tools/azure_dependencies.sh +++ b/tools/azure_dependencies.sh @@ -25,7 +25,7 @@ elif [ "${TEST_MODE}" == "pip-pre" ]; then echo "misc" python -m pip install $STD_ARGS imageio-ffmpeg xlrd mffpy python-picard pillow echo "nibabel with workaround" - python -m pip install --progress-bar off git+https://github.com/mscheltienne/nibabel.git@np.sctypes + python -m pip install --progress-bar off git+https://github.com/nipy/nibabel.git echo "joblib" python -m pip install --progress-bar off git+https://github.com/joblib/joblib@master echo "EDFlib-Python" diff --git a/tools/github_actions_dependencies.sh b/tools/github_actions_dependencies.sh index 65a64e05ae5..c5f4dd0ea7e 100755 --- a/tools/github_actions_dependencies.sh +++ b/tools/github_actions_dependencies.sh @@ -44,7 +44,7 @@ else echo "mne-qt-browser" pip install $STD_ARGS git+https://github.com/mne-tools/mne-qt-browser echo "nibabel with workaround" - pip install $STD_ARGS git+https://github.com/mscheltienne/nibabel.git@np.sctypes + pip install $STD_ARGS git+https://github.com/nipy/nibabel.git echo "joblib" pip install $STD_ARGS git+https://github.com/joblib/joblib@master echo "EDFlib-Python" From d526fab05ac6008201d667f8db2277985fe50878 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 2 Nov 2023 12:06:14 -0400 Subject: [PATCH 2/3] FIX: Skip --- mne/decoding/tests/test_search_light.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mne/decoding/tests/test_search_light.py b/mne/decoding/tests/test_search_light.py index 00b4f98f997..e1229157148 100644 --- a/mne/decoding/tests/test_search_light.py +++ b/mne/decoding/tests/test_search_light.py @@ -2,6 +2,7 @@ # # License: BSD-3-Clause +import platform from inspect import signature import numpy as np @@ -10,7 +11,7 @@ from mne.decoding.search_light import GeneralizingEstimator, SlidingEstimator from mne.decoding.transformer import Vectorizer -from mne.utils import _record_warnings, use_log_level +from mne.utils import _record_warnings, check_version, use_log_level pytest.importorskip("sklearn") @@ -29,6 +30,9 @@ def make_data(): def test_search_light(): """Test SlidingEstimator.""" + # https://github.com/scikit-learn/scikit-learn/issues/27711 + if platform.system() == "Windows" and check_version("numpy", "2.0"): + pytest.skip("sklearn int_t / long long mismatch") from sklearn.linear_model import LogisticRegression, Ridge from sklearn.metrics import make_scorer, roc_auc_score from sklearn.pipeline import make_pipeline From 4b9504cf59ea1308d7872ae318495c59ab32493f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 2 Nov 2023 14:14:51 -0400 Subject: [PATCH 3/3] FIX: Ver --- mne/decoding/tests/test_search_light.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mne/decoding/tests/test_search_light.py b/mne/decoding/tests/test_search_light.py index e1229157148..3d5009763eb 100644 --- a/mne/decoding/tests/test_search_light.py +++ b/mne/decoding/tests/test_search_light.py @@ -31,7 +31,7 @@ def make_data(): def test_search_light(): """Test SlidingEstimator.""" # https://github.com/scikit-learn/scikit-learn/issues/27711 - if platform.system() == "Windows" and check_version("numpy", "2.0"): + if platform.system() == "Windows" and check_version("numpy", "2.0.0.dev0"): pytest.skip("sklearn int_t / long long mismatch") from sklearn.linear_model import LogisticRegression, Ridge from sklearn.metrics import make_scorer, roc_auc_score