Skip to main content

A Python library for seamless integration between PyVista (VTK) and modern Qt Quick (QML).

Project description

PyVistaQML

Pipeline Status Coverage

PyPI version Anaconda version Latest release date

Python Versions OS Support Platform availability

License

A robust, thread-safe bridge between PyVista (VTK) and modern Qt Quick (QML).

⚠️ Experimental Project ⚠️

PyVistaQML is currently an experimental library. It has been deeply tested and developed exclusively on macOS (Apple Silicon). While the underlying libraries are cross-platform, the OpenGL threading bridge may behave differently on Windows or Linux. Use with caution in production environments.

pyvistaqml is designed as a first attempt to mimic the behavior of pyvistaqt, but for the QML ecosystem. It allows you to embed high-performance 3D visualizations directly into QML applications using the familiar PyVista API.

Single Plotter API Multi-Plotter Sync
Preview Preview

Documentation

Full tutorials, API reference, and concept guides are available at:

👉 https://mosaic.gitlabpages.inria.fr/pyvistaqml 👈

Why pyvistaqml?

Integrating VTK into QML introduces two major architectural hurdles that this library handles automatically:

  • The Thread Divide: QML separates UI logic from OpenGL rendering. Modifying VTK objects from the main thread usually causes a segmentation fault. We use a Proxy Engine to route commands safely.
  • The Memory Trap: Python’s garbage collector often fails to see C++ circular references in VTK. We provide an aggressive Synchronous Teardown to prevent GPU memory leaks.

Installation

We highly recommend using pip to handle the underlying Qt and VTK binaries.

# Via PyPI
pip install pyvistaqml

# Via Anaconda
conda install -c mosaic -c conda-forge pyvistaqml

# Via Source
git clone https://gitlab.inria.fr/mosaic/pyvistaqml.git
cd pyvistaqml
conda create -n pyvistaqml python=3.12
conda activate pyvistaqml
python -m pip install -e .

You can also run the tests to verify your installation:

python -m pip install -e ".[test]"
pytest

Features

  • Drop-in PyVista API: Inherits from pyvista.BasePlotter. Most of your existing PyVista code will work out of the box.
  • Asynchronous Proxy Engine: Interact with VTK objects synchronously in Python; the library handles the async thread routing under the hood.
  • Native QML Fbo Component: Renders directly into the Qt Quick Scene Graph using a custom Framebuffer Object.
  • Advanced Render Control: Support for debounce_render, custom threading decorators, and direct synchronous VTK access when needed.
  • Multi-Renderer & Camera Linking: Fully supports multiple viewports and hardware-accelerated camera synchronization.

Acknowledgments

This project is a higher-level framework built upon the foundational work of:

pyvistaqml is distributed under the LGPLv3 license. See LICENSE.md for details.

Included Examples

The repository includes comprehensive examples to help you get started:

  • examples/base_plotter_methods/: A fully featured test bench demonstrating how to use almost all BasePlotter capabilities inside a QML UI. It covers adding 3D geometry, applying VTK widgets (sliders, planes, boxes), handling complex picking events, and manipulating the camera.

  • examples/multiplotter/: Demonstrates advanced architecture by dynamically spawning a grid of multiple 3D viewports. It highlights hardware-accelerated camera synchronization (link_cameras), dynamic QML Repeater integration, and memory tracking.

Troubleshooting

VTK & Conda-Forge Warnings / Crashes (Linux & macOS)

Recent Conda versions of VTK (>=9.5) use the viskores engine, which can cause warnings, errors, or even segfaults. While it tends to be robust on macOS Silicon, Linux systems (especially with CUDA) are highly prone to crashing.

Solution: We strongly recommend using pip to install vtk for maximum stability across all hardware. If you must use Conda, force the CPU-only VTK package to avoid these issues: conda install -c conda-forge "vtk=*=*cpu*"

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

pyvistaqml-0.2.3.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

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

pyvistaqml-0.2.3-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file pyvistaqml-0.2.3.tar.gz.

File metadata

  • Download URL: pyvistaqml-0.2.3.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyvistaqml-0.2.3.tar.gz
Algorithm Hash digest
SHA256 6662a57ab88af52efad5b04f942b1ce88a525f78c01444b8710ce5c657752864
MD5 c1aef1ecc79fcd873a72d0e038b1b0a5
BLAKE2b-256 16913c25ab81fe89ac9c88d951b561960dbc5598380fa7cdcd85a03da900540b

See more details on using hashes here.

File details

Details for the file pyvistaqml-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pyvistaqml-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 37.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pyvistaqml-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aff1362e93b8a08299ab508559d007f122ec188f593033e42447b97e0cbfa5b0
MD5 77e6d3119ee565458192b3439c17b77c
BLAKE2b-256 1f1d4a3a454286bf305b2adf87c1c63b9b0a398c11aaf70e0b7d39eaa9bcaee7

See more details on using hashes here.

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