Skip to content

Commit 5d74c88

Browse files
committed
Fix JB2 in CI
1 parent d7c3c5f commit 5d74c88

2 files changed

Lines changed: 92 additions & 30 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,49 @@ jobs:
1919
environment:
2020
name: github-pages
2121
url: ${{ steps.deployment.outputs.page_url }}
22+
defaults:
23+
run:
24+
shell: bash -leo pipefail {0}
2225
runs-on: ubuntu-latest
2326
steps:
2427
- uses: actions/checkout@v5
2528

2629
- name: Set up Pages
2730
uses: actions/configure-pages@v5
2831

29-
- name: Set up Python
32+
- name: Set up conda env
3033
uses: mamba-org/setup-micromamba@v2
3134
with:
3235
environment-file: environment.yml
3336
cache-environment: true
37+
# create-args: >-
38+
# ipywidgets
39+
# trame
40+
# trame-vtk
41+
# trame-vuetify
42+
43+
- name: Install JB2
44+
run: python -m pip install -U --pre "jupyter-book==2.*" --no-deps -v
45+
46+
# - name: Set up PyVista (already present in ubuntu-24.04)
47+
# run: |
48+
# sudo apt-get update
49+
# sudo apt-get install -y libgl1 xvfb
50+
51+
# - name: Start xvfb
52+
# run: python -c "import pyvista as pv; pv.start_xvfb()"
53+
54+
# JB2 has --execute, but this way we can see how long it takes
55+
- name: Execute the notebook
56+
run: |
57+
python -c "import pyvista as pv; pv.start_xvfb()"
58+
jupyter nbconvert --to notebook --execute --inplace 03-viz.ipynb
59+
env:
60+
PYVISTA_OFF_SCREEN: true
61+
VTK_DEFAULT_BACKEND: X
3462

3563
- name: Build HTML
36-
run: jupyter-book build --html --execute --strict --ci
37-
shell: micromamba-shell {0}
64+
run: jupyter book build --html --strict --ci
3865

3966
- name: Upload artifact
4067
uses: actions/upload-pages-artifact@v4

03-viz.ipynb

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"title: Viz\n",
1616
"subtitle: Visualizing native-grid output in Python\n",
1717
"label: page:viz\n",
18+
"kernelspec:\n",
19+
" name: python3\n",
1820
"---"
1921
]
2022
},
@@ -53,6 +55,36 @@
5355
"cell_type": "code",
5456
"execution_count": null,
5557
"id": "2",
58+
"metadata": {},
59+
"outputs": [],
60+
"source": [
61+
"import sys\n",
62+
"\n",
63+
"print(f\"Python: {sys.version}\")\n",
64+
"\n",
65+
"try:\n",
66+
" import pyvista as pv\n",
67+
"\n",
68+
" print(f\"PyVista version: {pv.__version__}\")\n",
69+
" print(f\"Off screen: {pv.OFF_SCREEN}\")\n",
70+
"\n",
71+
" # Try a simple plot\n",
72+
" sphere = pv.Sphere()\n",
73+
" plotter = pv.Plotter(off_screen=True)\n",
74+
" plotter.add_mesh(sphere)\n",
75+
" plotter.show(screenshot=\"test.png\")\n",
76+
" print(\"SUCCESS: PyVista works!\")\n",
77+
"except Exception as e:\n",
78+
" print(f\"ERROR: {e}\")\n",
79+
" import traceback\n",
80+
"\n",
81+
" traceback.print_exc()"
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": null,
87+
"id": "3",
5688
"metadata": {
5789
"editable": true,
5890
"slideshow": {
@@ -76,14 +108,17 @@
76108
"import xarray as xr\n",
77109
"\n",
78110
"# https://docs.pyvista.org/user-guide/jupyter/index.html\n",
111+
"# if os.environ.get(\"CI\", \"true\") == \"true\":\n",
112+
"# pv.start_xvfb()\n",
79113
"pv.set_jupyter_backend(\"static\")\n",
114+
"# pv.set_jupyter_backend(\"html\")\n",
80115
"\n",
81116
"_ = xr.set_options(display_expand_data=False)"
82117
]
83118
},
84119
{
85120
"cell_type": "markdown",
86-
"id": "3",
121+
"id": "4",
87122
"metadata": {
88123
"editable": true,
89124
"slideshow": {
@@ -100,7 +135,7 @@
100135
{
101136
"cell_type": "code",
102137
"execution_count": null,
103-
"id": "4",
138+
"id": "5",
104139
"metadata": {
105140
"editable": true,
106141
"slideshow": {
@@ -141,7 +176,7 @@
141176
{
142177
"cell_type": "code",
143178
"execution_count": null,
144-
"id": "5",
179+
"id": "6",
145180
"metadata": {
146181
"editable": true,
147182
"slideshow": {
@@ -167,7 +202,7 @@
167202
},
168203
{
169204
"cell_type": "markdown",
170-
"id": "6",
205+
"id": "7",
171206
"metadata": {
172207
"editable": true,
173208
"slideshow": {
@@ -184,7 +219,7 @@
184219
{
185220
"cell_type": "code",
186221
"execution_count": null,
187-
"id": "7",
222+
"id": "8",
188223
"metadata": {},
189224
"outputs": [],
190225
"source": [
@@ -211,7 +246,7 @@
211246
{
212247
"cell_type": "code",
213248
"execution_count": null,
214-
"id": "8",
249+
"id": "9",
215250
"metadata": {},
216251
"outputs": [],
217252
"source": [
@@ -238,7 +273,7 @@
238273
{
239274
"cell_type": "code",
240275
"execution_count": null,
241-
"id": "9",
276+
"id": "10",
242277
"metadata": {},
243278
"outputs": [],
244279
"source": [
@@ -260,7 +295,7 @@
260295
{
261296
"cell_type": "code",
262297
"execution_count": null,
263-
"id": "10",
298+
"id": "11",
264299
"metadata": {},
265300
"outputs": [],
266301
"source": [
@@ -289,7 +324,7 @@
289324
{
290325
"cell_type": "code",
291326
"execution_count": null,
292-
"id": "11",
327+
"id": "12",
293328
"metadata": {},
294329
"outputs": [],
295330
"source": [
@@ -312,7 +347,7 @@
312347
},
313348
{
314349
"cell_type": "markdown",
315-
"id": "12",
350+
"id": "13",
316351
"metadata": {
317352
"editable": true,
318353
"slideshow": {
@@ -331,7 +366,7 @@
331366
{
332367
"cell_type": "code",
333368
"execution_count": null,
334-
"id": "13",
369+
"id": "14",
335370
"metadata": {
336371
"editable": true,
337372
"slideshow": {
@@ -347,7 +382,7 @@
347382
},
348383
{
349384
"cell_type": "markdown",
350-
"id": "14",
385+
"id": "15",
351386
"metadata": {
352387
"editable": true,
353388
"slideshow": {
@@ -364,7 +399,7 @@
364399
{
365400
"cell_type": "code",
366401
"execution_count": null,
367-
"id": "15",
402+
"id": "16",
368403
"metadata": {
369404
"editable": true,
370405
"slideshow": {
@@ -380,7 +415,7 @@
380415
{
381416
"cell_type": "code",
382417
"execution_count": null,
383-
"id": "16",
418+
"id": "17",
384419
"metadata": {
385420
"editable": true,
386421
"slideshow": {
@@ -397,7 +432,7 @@
397432
{
398433
"cell_type": "code",
399434
"execution_count": null,
400-
"id": "17",
435+
"id": "18",
401436
"metadata": {
402437
"editable": true,
403438
"slideshow": {
@@ -413,7 +448,7 @@
413448
{
414449
"cell_type": "code",
415450
"execution_count": null,
416-
"id": "18",
451+
"id": "19",
417452
"metadata": {
418453
"editable": true,
419454
"slideshow": {
@@ -460,7 +495,7 @@
460495
},
461496
{
462497
"cell_type": "markdown",
463-
"id": "19",
498+
"id": "20",
464499
"metadata": {
465500
"editable": true,
466501
"slideshow": {
@@ -477,7 +512,7 @@
477512
{
478513
"cell_type": "code",
479514
"execution_count": null,
480-
"id": "20",
515+
"id": "21",
481516
"metadata": {
482517
"editable": true,
483518
"slideshow": {
@@ -502,7 +537,7 @@
502537
{
503538
"cell_type": "code",
504539
"execution_count": null,
505-
"id": "21",
540+
"id": "22",
506541
"metadata": {},
507542
"outputs": [],
508543
"source": [
@@ -532,7 +567,7 @@
532567
{
533568
"cell_type": "code",
534569
"execution_count": null,
535-
"id": "22",
570+
"id": "23",
536571
"metadata": {
537572
"editable": true,
538573
"slideshow": {
@@ -567,7 +602,7 @@
567602
},
568603
{
569604
"cell_type": "markdown",
570-
"id": "23",
605+
"id": "24",
571606
"metadata": {
572607
"editable": true,
573608
"slideshow": {
@@ -586,7 +621,7 @@
586621
{
587622
"cell_type": "code",
588623
"execution_count": null,
589-
"id": "24",
624+
"id": "25",
590625
"metadata": {
591626
"editable": true,
592627
"slideshow": {
@@ -629,7 +664,7 @@
629664
},
630665
{
631666
"cell_type": "markdown",
632-
"id": "25",
667+
"id": "26",
633668
"metadata": {},
634669
"source": [
635670
"(sec:geovista)=\n",
@@ -644,7 +679,7 @@
644679
{
645680
"cell_type": "code",
646681
"execution_count": null,
647-
"id": "26",
682+
"id": "27",
648683
"metadata": {},
649684
"outputs": [],
650685
"source": [
@@ -679,7 +714,7 @@
679714
{
680715
"cell_type": "code",
681716
"execution_count": null,
682-
"id": "27",
717+
"id": "28",
683718
"metadata": {},
684719
"outputs": [],
685720
"source": [
@@ -705,7 +740,7 @@
705740
},
706741
{
707742
"cell_type": "markdown",
708-
"id": "28",
743+
"id": "29",
709744
"metadata": {
710745
"editable": true,
711746
"slideshow": {
@@ -732,7 +767,7 @@
732767
{
733768
"cell_type": "code",
734769
"execution_count": null,
735-
"id": "29",
770+
"id": "30",
736771
"metadata": {
737772
"editable": true,
738773
"slideshow": {

0 commit comments

Comments
 (0)