PyVista-like API for vtk.js
Project description
pyvista-js
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
pip install pyvista-js
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:
- Provide PyVista-like API for browser environments
- Leverage vtk.js for efficient WebGL rendering
- Enable 3D visualization in Pyodide/stlite applications
Related Projects
License
BSD 3-Clause License - See LICENSE for details.
This project uses vtk.js which is also licensed under BSD 3-Clause License.
Acknowledgments
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Tetsuo Koyama 🤔 📖 💻 👀 🐛 |
All Contributors 📖 |
pre-commit 🚧 |
Claude 🐛 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvista_js-0.2.1.tar.gz.
File metadata
- Download URL: pyvista_js-0.2.1.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb38fdaaf59a7e3b5e9b12ab32d4ad3b3f8662c6907fcdd3069af939e3279c8e
|
|
| MD5 |
a34c7d6de50e8be4df18f3ca2ae9465b
|
|
| BLAKE2b-256 |
6bf3b88dba9ed7782f6cdf2ca9845bab43f112e6793d69888e17761e54e5dd96
|
Provenance
The following attestation bundles were made for pyvista_js-0.2.1.tar.gz:
Publisher:
publish-pypi.yml on tkoyama010/pyvista-js
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_js-0.2.1.tar.gz -
Subject digest:
fb38fdaaf59a7e3b5e9b12ab32d4ad3b3f8662c6907fcdd3069af939e3279c8e - Sigstore transparency entry: 1059178754
- Sigstore integration time:
-
Permalink:
tkoyama010/pyvista-js@65b8c3f84ce50d7bde554294978b32a42c07fc3e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/tkoyama010
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@65b8c3f84ce50d7bde554294978b32a42c07fc3e -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyvista_js-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pyvista_js-0.2.1-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1bd5e3880d00e1e2e5626ac1c5acf86a0a188df72648d5fa7ae0b1395503af8
|
|
| MD5 |
31d440615ca9b6fb2322c6f4d2374cb6
|
|
| BLAKE2b-256 |
4e6df8f0f3e0cf7f53fb27f211bae175e2235f793be26459016d383c824a3e5e
|
Provenance
The following attestation bundles were made for pyvista_js-0.2.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on tkoyama010/pyvista-js
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvista_js-0.2.1-py3-none-any.whl -
Subject digest:
d1bd5e3880d00e1e2e5626ac1c5acf86a0a188df72648d5fa7ae0b1395503af8 - Sigstore transparency entry: 1059178802
- Sigstore integration time:
-
Permalink:
tkoyama010/pyvista-js@65b8c3f84ce50d7bde554294978b32a42c07fc3e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/tkoyama010
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@65b8c3f84ce50d7bde554294978b32a42c07fc3e -
Trigger Event:
release
-
Statement type: