Skip to content

Commit 19eea32

Browse files
committed
Fix JB2 in CI
1 parent d7c3c5f commit 19eea32

2 files changed

Lines changed: 95 additions & 30 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,50 @@ 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
47+
# libgl1 and xvfb already present in ubuntu-24.04
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y libglx-mesa0 libgl1 xvfb
51+
52+
# - name: Start xvfb
53+
# run: python -c "import pyvista as pv; pv.start_xvfb()"
54+
55+
# JB2 has --execute, but this way we can see how long it takes
56+
- name: Execute the notebook
57+
run: |
58+
python -c "import pyvista as pv; pv.start_xvfb()"
59+
jupyter nbconvert --to notebook --execute --inplace 03-viz.ipynb
60+
env:
61+
PYVISTA_OFF_SCREEN: true
62+
VTK_DEFAULT_BACKEND: X
3463

3564
- name: Build HTML
36-
run: jupyter-book build --html --execute --strict --ci
37-
shell: micromamba-shell {0}
65+
run: jupyter book build --html --strict --ci
3866

3967
- name: Upload artifact
4068
uses: actions/upload-pages-artifact@v4

03-viz.ipynb

Lines changed: 64 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,38 @@
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+
" pv.set_jupyter_backend(\"static\")\n",
72+
"\n",
73+
" # Try a simple plot\n",
74+
" sphere = pv.Sphere()\n",
75+
" plotter = pv.Plotter(off_screen=True)\n",
76+
" plotter.add_mesh(sphere)\n",
77+
" plotter.show(screenshot=\"test.png\")\n",
78+
" print(\"SUCCESS: PyVista works!\")\n",
79+
"except Exception as e:\n",
80+
" print(f\"ERROR: {e}\")\n",
81+
" import traceback\n",
82+
"\n",
83+
" traceback.print_exc()"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"id": "3",
5690
"metadata": {
5791
"editable": true,
5892
"slideshow": {
@@ -76,14 +110,17 @@
76110
"import xarray as xr\n",
77111
"\n",
78112
"# https://docs.pyvista.org/user-guide/jupyter/index.html\n",
113+
"# if os.environ.get(\"CI\", \"true\") == \"true\":\n",
114+
"# pv.start_xvfb()\n",
79115
"pv.set_jupyter_backend(\"static\")\n",
116+
"# pv.set_jupyter_backend(\"html\")\n",
80117
"\n",
81118
"_ = xr.set_options(display_expand_data=False)"
82119
]
83120
},
84121
{
85122
"cell_type": "markdown",
86-
"id": "3",
123+
"id": "4",
87124
"metadata": {
88125
"editable": true,
89126
"slideshow": {
@@ -100,7 +137,7 @@
100137
{
101138
"cell_type": "code",
102139
"execution_count": null,
103-
"id": "4",
140+
"id": "5",
104141
"metadata": {
105142
"editable": true,
106143
"slideshow": {
@@ -141,7 +178,7 @@
141178
{
142179
"cell_type": "code",
143180
"execution_count": null,
144-
"id": "5",
181+
"id": "6",
145182
"metadata": {
146183
"editable": true,
147184
"slideshow": {
@@ -167,7 +204,7 @@
167204
},
168205
{
169206
"cell_type": "markdown",
170-
"id": "6",
207+
"id": "7",
171208
"metadata": {
172209
"editable": true,
173210
"slideshow": {
@@ -184,7 +221,7 @@
184221
{
185222
"cell_type": "code",
186223
"execution_count": null,
187-
"id": "7",
224+
"id": "8",
188225
"metadata": {},
189226
"outputs": [],
190227
"source": [
@@ -211,7 +248,7 @@
211248
{
212249
"cell_type": "code",
213250
"execution_count": null,
214-
"id": "8",
251+
"id": "9",
215252
"metadata": {},
216253
"outputs": [],
217254
"source": [
@@ -238,7 +275,7 @@
238275
{
239276
"cell_type": "code",
240277
"execution_count": null,
241-
"id": "9",
278+
"id": "10",
242279
"metadata": {},
243280
"outputs": [],
244281
"source": [
@@ -260,7 +297,7 @@
260297
{
261298
"cell_type": "code",
262299
"execution_count": null,
263-
"id": "10",
300+
"id": "11",
264301
"metadata": {},
265302
"outputs": [],
266303
"source": [
@@ -289,7 +326,7 @@
289326
{
290327
"cell_type": "code",
291328
"execution_count": null,
292-
"id": "11",
329+
"id": "12",
293330
"metadata": {},
294331
"outputs": [],
295332
"source": [
@@ -312,7 +349,7 @@
312349
},
313350
{
314351
"cell_type": "markdown",
315-
"id": "12",
352+
"id": "13",
316353
"metadata": {
317354
"editable": true,
318355
"slideshow": {
@@ -331,7 +368,7 @@
331368
{
332369
"cell_type": "code",
333370
"execution_count": null,
334-
"id": "13",
371+
"id": "14",
335372
"metadata": {
336373
"editable": true,
337374
"slideshow": {
@@ -347,7 +384,7 @@
347384
},
348385
{
349386
"cell_type": "markdown",
350-
"id": "14",
387+
"id": "15",
351388
"metadata": {
352389
"editable": true,
353390
"slideshow": {
@@ -364,7 +401,7 @@
364401
{
365402
"cell_type": "code",
366403
"execution_count": null,
367-
"id": "15",
404+
"id": "16",
368405
"metadata": {
369406
"editable": true,
370407
"slideshow": {
@@ -380,7 +417,7 @@
380417
{
381418
"cell_type": "code",
382419
"execution_count": null,
383-
"id": "16",
420+
"id": "17",
384421
"metadata": {
385422
"editable": true,
386423
"slideshow": {
@@ -397,7 +434,7 @@
397434
{
398435
"cell_type": "code",
399436
"execution_count": null,
400-
"id": "17",
437+
"id": "18",
401438
"metadata": {
402439
"editable": true,
403440
"slideshow": {
@@ -413,7 +450,7 @@
413450
{
414451
"cell_type": "code",
415452
"execution_count": null,
416-
"id": "18",
453+
"id": "19",
417454
"metadata": {
418455
"editable": true,
419456
"slideshow": {
@@ -460,7 +497,7 @@
460497
},
461498
{
462499
"cell_type": "markdown",
463-
"id": "19",
500+
"id": "20",
464501
"metadata": {
465502
"editable": true,
466503
"slideshow": {
@@ -477,7 +514,7 @@
477514
{
478515
"cell_type": "code",
479516
"execution_count": null,
480-
"id": "20",
517+
"id": "21",
481518
"metadata": {
482519
"editable": true,
483520
"slideshow": {
@@ -502,7 +539,7 @@
502539
{
503540
"cell_type": "code",
504541
"execution_count": null,
505-
"id": "21",
542+
"id": "22",
506543
"metadata": {},
507544
"outputs": [],
508545
"source": [
@@ -532,7 +569,7 @@
532569
{
533570
"cell_type": "code",
534571
"execution_count": null,
535-
"id": "22",
572+
"id": "23",
536573
"metadata": {
537574
"editable": true,
538575
"slideshow": {
@@ -567,7 +604,7 @@
567604
},
568605
{
569606
"cell_type": "markdown",
570-
"id": "23",
607+
"id": "24",
571608
"metadata": {
572609
"editable": true,
573610
"slideshow": {
@@ -586,7 +623,7 @@
586623
{
587624
"cell_type": "code",
588625
"execution_count": null,
589-
"id": "24",
626+
"id": "25",
590627
"metadata": {
591628
"editable": true,
592629
"slideshow": {
@@ -629,7 +666,7 @@
629666
},
630667
{
631668
"cell_type": "markdown",
632-
"id": "25",
669+
"id": "26",
633670
"metadata": {},
634671
"source": [
635672
"(sec:geovista)=\n",
@@ -644,7 +681,7 @@
644681
{
645682
"cell_type": "code",
646683
"execution_count": null,
647-
"id": "26",
684+
"id": "27",
648685
"metadata": {},
649686
"outputs": [],
650687
"source": [
@@ -679,7 +716,7 @@
679716
{
680717
"cell_type": "code",
681718
"execution_count": null,
682-
"id": "27",
719+
"id": "28",
683720
"metadata": {},
684721
"outputs": [],
685722
"source": [
@@ -705,7 +742,7 @@
705742
},
706743
{
707744
"cell_type": "markdown",
708-
"id": "28",
745+
"id": "29",
709746
"metadata": {
710747
"editable": true,
711748
"slideshow": {
@@ -732,7 +769,7 @@
732769
{
733770
"cell_type": "code",
734771
"execution_count": null,
735-
"id": "29",
772+
"id": "30",
736773
"metadata": {
737774
"editable": true,
738775
"slideshow": {

0 commit comments

Comments
 (0)