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