Skip to content

Commit 89df689

Browse files
committed
fix: properly bundle static_viewer.html
1 parent 38a7920 commit 89df689

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

examples/pyvista/html_export.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# /// script
2+
# requires-python = ">=3.10"
3+
# dependencies = [
4+
# "pyvista[all]",
5+
# ]
6+
# ///
7+
import pyvista as pv
8+
from pyvista import examples
9+
10+
mesh = examples.load_uniform()
11+
pl = pv.Plotter(shape=(1, 2))
12+
_ = pl.add_mesh(mesh, scalars="Spatial Point Data", show_edges=True)
13+
pl.subplot(0, 1)
14+
_ = pl.add_mesh(mesh, scalars="Spatial Cell Data", show_edges=True)
15+
pl.export_html("pv.html")

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def tests(session, vtk):
1111
session.install("trame-vuetify")
1212
session.install("pytest-asyncio")
1313
session.install("coverage")
14-
session.install("pyvista==0.45.2")
14+
session.install("pyvista[all]==0.45.2")
1515
session.install(f"vtk{vtk}", "--extra-index-url", "https://wheels.vtk.org")
1616

1717
session.run("pytest", "--firefox", "--headless")

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ build-backend = "hatchling.build"
4040

4141
[tool.hatch.build]
4242
include = [
43-
"/src/trame_vtk/**/*.py",
43+
"/src/**/*.py",
44+
"/src/**/*.html",
4445
"/src/trame_vtk/modules/common/serve/**",
45-
"/src/trame/**/*.py",
4646
]
4747

4848
[tool.hatch.build.targets.wheel]

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ trame
22
trame-client[test]
33
trame-vuetify
44
vtk==9.4.2
5-
pyvista==0.45.2
5+
pyvista[all]==0.45.2
66
pytest-asyncio
77
coverage

tests/test_export.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pathlib import Path
2+
import pytest
3+
import asyncio
4+
import pyvista as pv
5+
from pyvista import examples
6+
7+
8+
@pytest.mark.asyncio
9+
async def test_export():
10+
mesh = examples.load_uniform()
11+
plotter = pv.Plotter(shape=(1, 2))
12+
plotter.add_mesh(mesh, scalars="Spatial Point Data", show_edges=True)
13+
plotter.subplot(0, 1)
14+
plotter.add_mesh(mesh, scalars="Spatial Cell Data", show_edges=True)
15+
plotter.export_html("pv.html")
16+
17+
await asyncio.sleep(0.1)
18+
plotter.close()
19+
assert Path("pv.html").exists()

0 commit comments

Comments
 (0)