A Streamlit component that allow support for new PyVista viewer backend: Trame.
Project description
Streamlit PyVista
A Streamlit component that allow support for new pyvista viewer backend : Trame.
Installation instructions
pip install streamlit-pyvista
Usage Instructions
import streamlit as st
from streamlit_pyvista.mesh_viewer_component import MeshViewerComponent
def main():
st.title("Simple Streamlit App With Pyvista Viewer")
mesh_viewer = MeshViewerComponent(
"https://gitlab.com/dcsm/streamlit-pyvista/-/raw/main/examples/assets/plate_hole.vtu")
mesh_viewer2 = MeshViewerComponent("assets/plate_hole.vtu")
mesh_viewer.show()
mesh_viewer2.show()
if __name__ == "__main__":
main()
Note that instead of a file path or a url it's also possible to pass an array of link or path to display a sequence of files.
This viewer leverage the capabilities of the new pyvista backend Trame, beyond the nice design revamp,
it also supports remote rendering.
Package documentation
You can find the automatic documentation generated with sphinx here
Workflow overview
This package has 3 different components:
- The Streamlit component
- The Trame viewers
- A "Server manager"
Streamlit component
This pyvista new backend requires now to have its own server for each instance of a pyvista plotter. This means that the streamlit component can be as simple as an iframe and displayed in the app and can use a simple api to communicate with the trame server and the server manger
Trame viewers
The Trame viewers are the servers that are embeded in the streamlit app, it has exposed api endpoints that allow the component to communicate with the server for action such as loading a mesh in the viewer.
Server manager
As said earlier, the trame viewers can only display one plotter at a time which means that if we want to display multiple plotters we need multiple servers. The job of the Server manager is to control how many trame viewers exists, if they need to killed or if they can be reused for other viewers
Workflow
These 3 components interact the following manner:
- A
MeshViewerComponentis created and notify aServerManagerthat it needs a viewer. - The
ServerManagerlook if he have idling trame viewer anf if not, it start a new server. - The
ServerManagerspecify the endpoints of the server that can be used to theMeshViewerComponent - The
MeshViewerComponentdirectly communicate with the api of the trame viewer via the endpoints specified by theServerManager
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 streamlit_pyvista-0.0.18.tar.gz.
File metadata
- Download URL: streamlit_pyvista-0.0.18.tar.gz
- Upload date:
- Size: 47.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61a77299e31200d0ba86f4922f9b67789d54a8e8d29c09661d09d832e7db6df5
|
|
| MD5 |
0b7f3ba5c8e36a8205f42a1f4becaaa9
|
|
| BLAKE2b-256 |
0f250230aa4cb13bc9fed0be364fffe45d8978a1c98b2d4e8a78a40589cef47c
|
File details
Details for the file streamlit_pyvista-0.0.18-py3-none-any.whl.
File metadata
- Download URL: streamlit_pyvista-0.0.18-py3-none-any.whl
- Upload date:
- Size: 57.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9183b54e7b52ebb6823a2972753f30de28a2ec7ad01d8cf6e1721a86d2751a7
|
|
| MD5 |
56927444bbf0dfccb9f7dbc718eae712
|
|
| BLAKE2b-256 |
0112452adb76df288bca5ea9698aa339283bd9b2a2cce0856ba4e8b940e76b07
|