Skip to content

Commit 05533fd

Browse files
DOC add interactive example via Jupyterlite (#173)
* DOC use xeus kernel * use conda-forge * add plantuml * remove rtd_pre_install * use conda openjdk * add note in forecasting example
1 parent e5cbafa commit 05533fd

File tree

16 files changed

+6229
-3646
lines changed

16 files changed

+6229
-3646
lines changed

.github/workflows/asv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Run benchmarks
4040
shell: bash
4141
run: |
42-
MACHINE=${{ matrix.os }} pixi run asv-build
42+
pixi run asv-build ${{ matrix.os }}
4343
4444
- name: Upload benchmark results
4545
uses: actions/upload-artifact@v4

.github/workflows/emscripten.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v5
1111
- name: Build WASM wheel
12-
uses: pypa/cibuildwheel@v3.1.4
12+
uses: pypa/cibuildwheel@v3.2.0
1313
env:
1414
CIBW_PLATFORM: pyodide
1515
- name: Upload package

.github/workflows/test.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,17 @@ jobs:
3232
run: |
3333
pixi run -e dev test
3434
- name: Test with doctest
35-
shell: bash
35+
if: matrix.os == 'ubuntu-latest'
3636
run: |
3737
pixi run -e dev doc
38-
CMD=doctest pixi run -e dev doc
38+
pixi run -e dev doc sphinx-build doctest
3939
- name: Test nogil
4040
run: |
4141
pixi run -e nogil nogil-eta
4242
- name: Test coverage
4343
if: matrix.os == 'ubuntu-latest'
44-
shell: bash
4544
run: |
46-
FMT=xml pixi run -e dev test-coverage
45+
pixi run -e dev test-coverage xml
4746
- name: Upload coverage reports to Codecov
4847
if: matrix.os == 'ubuntu-latest'
4948
uses: codecov/codecov-action@v5

.github/workflows/wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v5
3535
- name: Build wheels
36-
uses: pypa/cibuildwheel@v3.1.4
36+
uses: pypa/cibuildwheel@v3.2.0
3737
env:
3838
CIBW_SKIP: "*_i686 *_ppc64le *_s390x *_universal2 *-musllinux_* cp314t*"
3939
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ wheels/
3030
doc/_build/
3131
doc/generated/
3232
doc/auto_examples/
33-
doc/sg_execution_times.rst
33+
doc/sg_execution_times.rst
34+
doc/.jupyterlite.doit.db
35+
doc/jupyterlite_contents/
36+
doc/_contents/
37+
emsdk/

.readthedocs.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
version: 2
22
build:
3-
os: ubuntu-22.04
3+
os: ubuntu-24.04
44
tools:
5-
python: "3.13"
6-
apt_packages:
7-
- default-jre # for plantuml
8-
- graphviz # for plantuml
9-
jobs:
10-
pre_install:
11-
- bash scripts/rtd_pre_install.sh
5+
python: "mambaforge-latest"
6+
7+
conda:
8+
environment: rtd-environment.yml
129

1310
sphinx:
1411
configuration: doc/conf.py
15-
fail_on_warning: true
16-
17-
python:
18-
install:
19-
- method: pip
20-
path: .
21-
extra_requirements: [docs]
12+
fail_on_warning: true

doc/conf.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"sphinx_design",
4444
# For PlantUML diagrams
4545
"sphinxcontrib.plantuml",
46+
# For interactive examples via JupyterLite
47+
'jupyterlite_sphinx',
4648
]
4749

4850
# List of patterns, relative to source directory, that match files and
@@ -67,7 +69,7 @@
6769
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
6870
# Third-party theme: pip install furo
6971
html_theme = "furo"
70-
html_static_path = ["images"]
72+
html_static_path = ["images", "css"]
7173

7274

7375
# intersphinx configuration
@@ -79,3 +81,14 @@
7981
"examples_dirs": ["../examples"],
8082
"gallery_dirs": ["auto_examples"],
8183
}
84+
85+
# -----------------------------------------------------------------------------
86+
# Interactive documentation examples via JupyterLite
87+
# -----------------------------------------------------------------------------
88+
89+
global_enable_try_examples = True
90+
try_examples_global_button_text = "Try it in your browser!"
91+
try_examples_global_warning_text = (
92+
"If you encounter any issues, please report them on the"
93+
" [fastcan issue tracker](https://github.com/scikit-learn-contrib/fastcan/issues)."
94+
)

doc/css/fastcan.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.try_examples_button {
2+
color: white;
3+
background-color: #0054a6;
4+
border: none;
5+
padding: 5px 10px;
6+
border-radius: 10px;
7+
margin-bottom: 5px;
8+
box-shadow: 0 2px 5px rgba(108,108,108,0.2);
9+
}
10+
11+
.try_examples_button:hover {
12+
background-color: #0066cc;
13+
transform: scale(1.02);
14+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
15+
cursor: pointer;
16+
}
17+
18+
.try_examples_button_container {
19+
display: flex;
20+
justify-content: flex-end;
21+
}

doc/environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: xeus-kernels
2+
channels:
3+
- https://prefix.dev/emscripten-forge-dev
4+
- https://prefix.dev/conda-forge
5+
dependencies:
6+
- xeus-python
7+
- matplotlib
8+
- fastcan

doc/try_examples.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"global_min_height": "400px"
3+
}

0 commit comments

Comments
 (0)