Skip to content

Commit 3fbc67f

Browse files
bruarisbruAristimunhaPierreGtchpre-commit-ci[bot]Copilot
authored
Release 1.4.3 (#855)
* V1.4.2 (#845) * fixing the release * pushing to including the .csv * pre-commit * v 1.4.2 * Fix `SetRawAnnotations` when no stim channel (#838) * First try to fix * Add test * [pre-commit.ci] auto fixes from pre-commit.com hooks * Whats new * enforce desired event ids when creating events from annotations --------- Signed-off-by: Pierre Guetschel <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Increase compatibility with Python 3.14 (#848) * Initial plan * Increase compatibility with Python 3.14 Co-authored-by: bruAristimunha <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: bruAristimunha <[email protected]> * Fix warnings from scikit-learn 1.8+ and introduce FixedPipeline (#850) * p * fixing number * Fix compatibility with scikit-learn 1.8 (#852) * fixing more colab issues * updating the utils * Enhance documentation and update design elements (#853) * more design details * more adjust * more adjusts * more updates * updating the readme * removing the roadmap * first round * more modification and almost done * including subject info * remove the video * more details * updating to colab * updating the citation * updating the __init__ * Macro release (#854) --------- Signed-off-by: Pierre Guetschel <[email protected]> Co-authored-by: Bru <[email protected]> Co-authored-by: Pierre Guetschel <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]> Co-authored-by: bruAristimunha <[email protected]>
1 parent 7076d75 commit 3fbc67f

36 files changed

+1235
-311
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
"""
2+
Convert Python example scripts to Jupyter notebooks for Colab integration.
3+
4+
This script converts Sphinx-Gallery style Python examples to Jupyter notebooks.
5+
It is adapted from Braindecode's docs workflow utilities.
6+
"""
7+
8+
from __future__ import annotations
9+
10+
import argparse
11+
import copy
12+
from pathlib import Path
13+
14+
import nbformat
15+
from sphinx_gallery import gen_gallery
16+
from sphinx_gallery.notebook import jupyter_notebook, save_notebook
17+
from sphinx_gallery.py_source_parser import split_code_and_text_blocks
18+
19+
20+
def convert_script_to_notebook(
21+
src_file: Path, output_file: Path, gallery_conf: dict
22+
) -> None:
23+
"""Convert a single Python script to a Jupyter notebook."""
24+
# Parse the Python file
25+
_file_conf, blocks = split_code_and_text_blocks(str(src_file))
26+
27+
# Convert to notebook (returns a dict, not a notebook object)
28+
example_nb_dict = jupyter_notebook(blocks, gallery_conf, str(src_file.parent))
29+
30+
# Convert dict to nbformat notebook object
31+
example_nb = nbformat.from_dict(example_nb_dict)
32+
33+
# Prepend an installation cell for moabb (unless the example already does so)
34+
first_source = ""
35+
if getattr(example_nb, "cells", None):
36+
try:
37+
first_source = example_nb.cells[0].source
38+
except (IndexError, AttributeError):
39+
first_source = ""
40+
41+
install_cmd = "%pip install moabb"
42+
if "pip install" not in first_source or "moabb" not in first_source:
43+
install_cell = nbformat.v4.new_code_cell(source=install_cmd)
44+
install_cell.metadata["language"] = "python"
45+
example_nb.cells.insert(0, install_cell)
46+
47+
output_file.parent.mkdir(parents=True, exist_ok=True)
48+
save_notebook(example_nb, output_file)
49+
50+
51+
def main() -> int:
52+
parser = argparse.ArgumentParser(
53+
description="Convert a Python example script to a Jupyter notebook."
54+
)
55+
parser.add_argument("--input", required=True, help="Path to the Python script.")
56+
parser.add_argument("--output", required=True, help="Path to the output notebook.")
57+
args = parser.parse_args()
58+
59+
input_path = Path(args.input)
60+
output_path = Path(args.output)
61+
62+
gallery_conf = copy.deepcopy(gen_gallery.DEFAULT_GALLERY_CONF)
63+
64+
convert_script_to_notebook(input_path, output_path, gallery_conf)
65+
print(f"Notebook saved to: {output_path}")
66+
return 0
67+
68+
69+
if __name__ == "__main__":
70+
raise SystemExit(main())

.github/workflows/docs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ jobs:
6161
run: |
6262
cd docs && make html
6363
64+
- name: Generate notebooks from examples (Colab)
65+
run: |
66+
set -euo pipefail
67+
echo "Converting Python examples to notebooks in docs/build/html/auto_examples/_notebooks..."
68+
mkdir -p docs/build/html/auto_examples/_notebooks
69+
find examples -type f -name '*.py' | while read -r f; do
70+
rel="${f#examples/}"
71+
out_dir="docs/build/html/auto_examples/_notebooks/$(dirname "$rel")"
72+
mkdir -p "$out_dir"
73+
base="$(basename "$rel" .py)"
74+
out_path="$out_dir/$base.ipynb"
75+
python .github/scripts/convert_to_notebook.py --input "$f" --output "$out_path"
76+
done
77+
6478
# Create an artifact of the html output.
6579
- uses: actions/upload-artifact@v4
6680
with:

.github/workflows/download-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: true
1616
matrix:
1717
os: [ ubuntu-latest]
18-
python-version: [ "3.9" ]
18+
python-version: [ "3.10" ]
1919
defaults:
2020
run:
2121
shell: bash

.github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ jobs:
1616
strategy:
1717
fail-fast: true
1818
matrix:
19-
os: [ ubuntu-latest, macOS-latest, windows-latest ]
20-
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
21-
exclude:
19+
os: [ ubuntu-latest ]
20+
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
21+
include:
22+
- os: macOS-latest
23+
python-version: "3.12"
2224
- os: windows-latest
23-
python-version: "3.13"
25+
python-version: "3.12"
2426
defaults:
2527
run:
2628
shell: bash

CITATION.cff

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cff-version: 1.3.0
1+
cff-version: 1.4
22
message: "If you use this software, please cite it as below."
33
authors:
44
- family-names: "Aristimunha"
@@ -51,6 +51,9 @@ authors:
5151
- family-names: "Goncharenko"
5252
given-names: "Vladislav"
5353
orcid: "https://orcid.org/0000-0002-9243-6914"
54+
- family-names: "Andreev"
55+
given-names: "Anton"
56+
orcid: "https://orcid.org/000-0002-4466-4525"
5457
- family-names: "Thielen"
5558
given-names: "Jordy"
5659
orcid: "https://orcid.org/0000-0002-6264-0367"
@@ -70,7 +73,7 @@ authors:
7073
given-names: "Sylvain"
7174
orcid: "https://orcid.org/0000-0003-3027-8241"
7275
title: "Mother of all BCI Benchmarks"
73-
version: 1.4.0
76+
version: 1.4.3
7477
doi: 10.5281/zenodo.10034223
75-
date-released: 2025-11-07
78+
date-released: 2025-12-12
7679
url: "https://github.com/NeuroTechX/moabb"

0 commit comments

Comments
 (0)