Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tkoyama010
Copy link
Member

@tkoyama010 tkoyama010 commented Jul 16, 2025

Summary

This PR introduces VTK WebAssembly (vtk-wasm) as a new rendering backend option for PyVista in Jupyter environments and documentation generation.

  • Add 'vtk-wasm' to JupyterBackendOptions type definitions
  • Implement show_vtk_wasm() function with HTML/IFrame integration
  • Add vtk-wasm dependency validation and error handling
  • Include comprehensive documentation for the new backend
  • Add optional 'wasm' dependency group in pyproject.toml

Key Features

The vtk-wasm backend provides:

  • Native VTK performance in browsers without server connections
  • Alternative to Trame-based rendering for client-side scenarios
  • Easy installation via pip install pyvista[wasm]
  • Graceful fallback to static rendering if dependencies are unavailable

Installation

The vtk-wasm backend requires VTK version 9.4 or higher and trame-vtklocal:

pip install vtk>=9.4 trame-vtklocal

Or install with PyVista's wasm extras:

pip install pyvista[wasm]

Usage

import pyvista as pv

# Set vtk-wasm as the Jupyter backend
pv.set_jupyter_backend('vtk-wasm')

# Create and display a plot
sphere = pv.Sphere()
sphere.plot()  # Renders using VTK WebAssembly

Test plan

  • Syntax validation of modified files passes
  • Pre-commit hooks pass (ruff, formatting, etc.)
  • Correct package dependencies identified and implemented
  • Manual testing with vtk-wasm package installed
  • Documentation builds correctly with new backend option
  • JupyterLab integration testing
  • Verify graceful fallback when dependencies unavailable

Generated with Claude Code

This commit introduces VTK WebAssembly (vtk-wasm) as a new rendering backend option
for PyVista in Jupyter environments and documentation generation.

Key changes:
- Add 'vtk-wasm' to JupyterBackendOptions type definitions
- Implement show_vtk_wasm() function with HTML/IFrame integration
- Add vtk-wasm dependency validation and error handling
- Include comprehensive documentation for the new backend
- Add optional 'wasm' dependency group in pyproject.toml

The vtk-wasm backend provides native VTK performance in browsers without
requiring server connections, offering an alternative to existing Trame-based
client/server rendering approaches.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@tkoyama010 tkoyama010 force-pushed the feature/vtk-wasm-rendering branch from 7ad00c1 to a5755cf Compare July 16, 2025 00:07
@pyvista-bot pyvista-bot added maintenance Low-impact maintenance activity enhancement Changes that enhance the library labels Jul 16, 2025
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.33%. Comparing base (3245aff) to head (42864a2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7720      +/-   ##
==========================================
- Coverage   96.39%   96.33%   -0.06%     
==========================================
  Files         150      150              
  Lines       32668    32688      +20     
  Branches     4116     4118       +2     
==========================================
+ Hits        31489    31491       +2     
- Misses        573      589      +16     
- Partials      606      608       +2     

@pyvista-bot
Copy link
Contributor

pyvista-bot commented Jul 16, 2025

# TODO: Integrate actual VTK scene data with vtk-wasm viewer

# Export the VTK scene data
with tempfile.NamedTemporaryFile(mode='w', suffix='.html', delete=False) as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://kitware.github.io/vtk-wasm/guide/viewer/data.html but we don't have a self contained html+data option.

@pyvista-bot pyvista-bot temporarily deployed to pull request September 5, 2025 03:17 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes that enhance the library maintenance Low-impact maintenance activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants