@@ -19,22 +19,89 @@ 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+ # mesalib
39+ # ipywidgets
40+ # trame
41+ # trame-vtk
42+ # trame-vuetify
43+
44+ - name : Install JB2
45+ run : python -m pip install -U --pre "jupyter-book==2.*" --no-deps -v
46+
47+ # - name: Set up PyVista
48+ # # libglx-mesa0, libgl1, xvfb already present in ubuntu-24.04
49+ # run: |
50+ # sudo apt-get update
51+ # sudo apt-get install -y libglx-mesa0 libgl1 xvfb libosmesa6
52+
53+ # - name: Start xvfb
54+ # run: python -c "import pyvista as pv; pv.start_xvfb()"
55+
56+ - name : PyVista test
57+ run : |
58+ xvfb-run -s "-screen 0 1024x768x24" python -c '
59+ import os
60+ import vtk
61+ import pyvista as pv
62+
63+ pv.BUILDING_GALLERY = True
64+
65+ print("=== Environment variables ===")
66+ print("VTK_DEFAULT_OPENGL_WINDOW =", os.environ.get("VTK_DEFAULT_OPENGL_WINDOW"))
67+ print("PYVISTA_OFF_SCREEN =", os.environ.get("PYVISTA_OFF_SCREEN"))
68+
69+ print("\n=== VTK backend check ===")
70+ rw = vtk.vtkRenderWindow()
71+ print("RenderWindow backend:", rw.GetClassName())
72+
73+ print("\n=== PyVista backend check ===")
74+ # print("PyVista rendering_backend:", pv.global_theme.rendering_backend)
75+
76+ # Force PyVista to off-screen if not already
77+ # pv.global_theme.off_screen = True
78+ print("PyVista OFF_SCREEN before:", pv.OFF_SCREEN)
79+ pv.OFF_SCREEN = True
80+
81+ print("\n=== Rendering test ===")
82+ sphere = pv.Sphere()
83+ plotter = pv.Plotter(off_screen=True)
84+ plotter.add_mesh(sphere, color="tomato")
85+ plotter.show(screenshot="backend_test.png")
86+ print("Rendered sphere saved as backend_test.png")
87+ '
88+ env :
89+ PYVISTA_OFF_SCREEN : true
90+ # VTK_DEFAULT_OPENGL_WINDOW: vtkOSOpenGLRenderWindow
91+ VTK_DEFAULT_OPENGL_WINDOW : vtkXOpenGLRenderWindow
92+
93+ # JB2 has --execute, but this way we can see how long it takes
94+ - name : Execute the notebook
95+ run : jupyter nbconvert --to notebook --execute --inplace 03-viz.ipynb
96+ env :
97+ PYVISTA_OFF_SCREEN : true
98+ # VTK_DEFAULT_BACKEND: X
99+ # VTK_USE_OSMESA: "1"
100+ # VTK_DEFAULT_OPENGL_WINDOW: vtkOSOpenGLRenderWindow
101+ VTK_DEFAULT_OPENGL_WINDOW : vtkXOpenGLRenderWindow
34102
35103 - name : Build HTML
36- run : jupyter-book build --html --execute --strict --ci
37- shell : micromamba-shell {0}
104+ run : jupyter book build --html --strict --ci
38105
39106 - name : Upload artifact
40107 uses : actions/upload-pages-artifact@v4
0 commit comments