Skip to main content

PyVista-like API for vtk.js

Project description

pyvista-js

PyPI License Python JupyterLite

PyVista-like API for vtk.js - Bring intuitive 3D visualization to the browser.

Vision

Provide a familiar PyVista interface that works seamlessly in browser environments (Pyodide, stlite, JupyterLite) by leveraging vtk.js under the hood.

Quick Example (Goal)

import pyvista_js as pv
import streamlit as st

# Create a plotter
plotter = pv.Plotter()

# Add a mesh
mesh = pv.Sphere()
plotter.add_mesh(mesh, color='red', opacity=0.8)

# Display in browser
plotter.show()

Features (Planned)

  • 🎨 PyVista-like API - Familiar interface for PyVista users
  • 🌐 Browser-native - Runs entirely in the browser via Pyodide
  • vtk.js powered - Leverages the power of vtk.js for rendering
  • 📊 Streamlit/stlite support - Easy integration with web frameworks
  • 🔧 Lightweight - No server required, pure client-side

Installation (Future)

pip install pyvista-js

For Streamlit support:

pip install pyvista-js[streamlit]

For Pyodide/stlite:

import micropip
await micropip.install('pyvista-js')

Usage

Basic Example

import pyvista_js as pv

# Create a plotter
plotter = pv.Plotter()

# Add a mesh
mesh = pv.Sphere(radius=1.0)
plotter.add_mesh(mesh, color='red', opacity=0.8)

# Display (in Pyodide/browser environment)
plotter.show()

Streamlit/stlite Example

import streamlit as st
import pyvista_js as pv

st.title("3D Visualization")

# Create visualization
plotter = pv.Plotter()
sphere = pv.Sphere()
plotter.add_mesh(sphere, color='blue')

# Display in Streamlit
pv.pyvista_chart(plotter, height=600)

API Design

Core Classes

# Plotter - Main visualization interface
plotter = pv.Plotter()
plotter.add_mesh(mesh, **kwargs)
plotter.show()

# Geometric objects
sphere = pv.Sphere(radius=1.0, center=(0, 0, 0))
cube = pv.Cube()
cylinder = pv.Cylinder()

# Mesh operations
mesh.points  # NumPy array of vertices
mesh.faces   # Cell connectivity

Comparison with PyVista

Feature PyVista pyvista-js
Backend VTK (C++) vtk.js (WebGL)
Environment Desktop Browser
Installation pip install pyvista pip install pyvista-js
Rendering Native OpenGL WebGL
Server Required Optional No

Status

🚀 Beta - Core functionality implemented!

  • Core Plotter API
  • Basic geometric primitives (Sphere, Cube, Cylinder)
  • Mesh rendering with vtk.js
  • PyVista compatibility layer
  • Streamlit/stlite integration
  • Advanced mesh operations
  • Comprehensive documentation
  • More examples

Contributing

Contributions are welcome! This project aims to:

  1. Provide PyVista-like API for browser environments
  2. Leverage vtk.js for efficient WebGL rendering
  3. Enable 3D visualization in Pyodide/stlite applications

Related Projects

  • PyVista - 3D plotting and mesh analysis
  • vtk.js - VTK for the Web
  • stlite - Serverless Streamlit

License

BSD 3-Clause License - See LICENSE for details.

This project uses vtk.js which is also licensed under BSD 3-Clause License.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvista_js-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyvista_js-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file pyvista_js-0.1.0.tar.gz.

File metadata

  • Download URL: pyvista_js-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvista_js-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f7735ef2dc8c0e9f949b6b9db04394d3dae690ddd1dd42dd0d1aa7f72782a05
MD5 06b97b5bba16d22cf7625df7058d76bc
BLAKE2b-256 e68a81b67c4fb57c5cdfb6072aadaa3b6c6ea7b6a8e33422df8e8f934af125de

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_js-0.1.0.tar.gz:

Publisher: publish-pypi.yml on tkoyama010/pyvista-js

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvista_js-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyvista_js-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvista_js-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf9d58539e08ed42147675080a9b2f57a724a73173a4f33ca3e51d036a210deb
MD5 3f556b50e38dc9fcf0bdb6e464b27129
BLAKE2b-256 2387e0d65fafe654fb21f7561020311c1a708165c54a24efe305971b42e15453

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvista_js-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on tkoyama010/pyvista-js

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page