trame-vtklocal


Nametrame-vtklocal JSON
Version 0.7.1 PyPI version JSON
download
home_pageNone
SummaryVTK Local Rendering using WASM
upload_time2025-02-13 22:36:10
maintainerNone
docs_urlNone
authorKitware Inc.
requires_python>=3.9
licenseApache Software License
keywords python interactive web application framework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. |pypi_download| image:: https://img.shields.io/pypi/dm/trame-vtklocal

========================================================
trame-vtklocal  |pypi_download|
========================================================

Local Rendering using VTK.wasm to match server side rendering pipeline on the client side.
The current code base is still at its infancy but we aim to make it the default implementation for local rendering using VTK/ParaView with trame.
This WASM capability is starting to be available with VTK 9.4. 

.. In term of version compatibility between VTK and trame-vtklocal we aim to follow this pattern.
.. 
.. .. list-table:: Version compatibility
..    :widths: 50 50
..    :header-rows: 1

..    * - VTK
..      - trame-vtklocal
..    * - v9.4
..      - v0
..    * - v9.5
..      - v1

License
----------------------------------------

This library is OpenSource and follow the Apache Software License

Installation
----------------------------------------

.. code-block:: console

    # to install a compatible version of VTK
    pip install "trame-vtklocal[vtk]"

    # to install VTK yourself
    pip install trame-vtklocal
    pip install "vtk>=9.4,<9.5"


Development
----------------------------------------

Build and install the Vue components

.. code-block:: console

    cd vue-components
    npm i
    npm run build
    cd -

Install the library

.. code-block:: console

    pip install -e .

Optionally, you can develop with bleeding edge VTK by following these steps. Make sure you've these tools

1. git
2. CMake
3. Ninja
4. Python
5. NodeJS >= 22.0.0: https://nodejs.org/en/download/package-manager
6. Emscripten SDK: See https://emscripten.org/docs/getting_started/downloads.html#download-and-install

.. code-block:: console

    # Compile VTK for wasm32 architecture using emscripten. Build artifacts can be found in dev/vtk/build/wasm
    python ./utils/build_vtk.py -u https://gitlab.kitware.com/vtk/vtk.git -b master -t wasm32 -c RelWithDebInfo

    # Compile VTK with python wrappings using system C++ compiler. Build artifacts can be found in dev/vtk/build/py
    python ./utils/build_vtk.py -u https://gitlab.kitware.com/vtk/vtk.git -b master -t py -c RelWithDebInfo

    # Windows: Set environment variables
    ./utils/dev_environment.ps1 -b master -c RelWithDebInfo
    
    # Unix: Set environemt variables
    source ./utils/dev_environment.sh -b master -c RelWithDebInfo


Running examples
----------------------------------------

.. code-block:: console

    pip install trame "trame-vtklocal[vtk]" trame-vuetify trame-vtk

    # regular trame app
    python ./examples/vtk/cone.py 


Some example are meant to test and validate WASM rendering.
Some will default for remote rendering but if you want to force them to use WASM just run `export USE_WASM=1` before executing them.

SharedArrayBuffer
----------------------------------------

To enable SharedArrayBuffer within trame you can just set the following on the server. 
This option is not required anymore but still available if needed.

.. code-block:: console

    server.http_headers.shared_array_buffer = True


This will download the threaded WASM version. Otherwise, the non-threaded version will be used as it does not require SharedArrayBuffer.


VTK.wasm vs trame-vtklocal
----------------------------------------

This repository `trame-vtklocal` focus on providing a web component that is capable of mirroring a `vtkRenderWindow` defined on the server side.
This include a JavaScript section for the browser and a Python section for the server. 

The server include a definition of a custom network protocol over our WebSocket (wslink/trame) and some helper class to ease the vtkRenderWindow binding with a web component in the browser.
While the Python package include a Vue.js component for a seamless integration with trame, we also publish a `npm package <https://www.npmjs.com/package/@kitware/trame-vtklocal>`_.
That pure JavaScript library let you still use the trame infrastructure on the server side but with your own stack on the client side. A usage example of that pure JavaScript option is covered `in that directory <https://github.com/Kitware/trame-vtklocal/tree/master/examples/pure-js>`_.

For the pure Python trame usage, you can find the `documented API <https://trame.readthedocs.io/en/latest/trame.widgets.vtklocal.html>`_.

By design there is a nice separation between VTK.wasm and trame-vtklocal which should make trame-vtklocal fairly independent of VTK.wasm version. 
But since we are still building capabilities, when the C++ API expend, we will also expand the Python/JavaScript component properties/methods. 
Hopefully we should be able to evolve trame-vtklocal with some reasonable fallback when the version of VTK is not in par with what is exposed in trame-vtklocal.

Also most the testing of VTK.wasm is in VTK repository as many validation can be done in pure C++ or `Python <https://gitlab.kitware.com/vtk/vtk/-/tree/master/Serialization/Manager/Testing/Python>`_. 
Then we have `the WASM module API <https://gitlab.kitware.com/vtk/vtk/-/blob/master/Web/WebAssembly/vtkWasmSceneManagerEmBinding.cxx>`_  with its `node/chrome testing <https://gitlab.kitware.com/vtk/vtk/-/tree/master/Web/WebAssembly/Testing/JavaScript>`_.

The documented API of `vtkWasmSceneManager <https://vtk.org/doc/nightly/html/classvtkWasmSceneManager.html>`_ and `vtkObjectManager parent of vtkWasmSceneManager <https://vtk.org/doc/nightly/html/classvtkObjectManager.html>`_

For the moment we rely on manual testing for when we change the network and/or API at the trame-vtklocal by going over a specific set of `examples <https://github.com/Kitware/trame-vtklocal/tree/master/examples>`_.

Currently the WASM implementation is used in the following set of projects:

- `Pan3D <https://github.com/Kitware/pan3d/>`_: Pan3D aims to be an utility package for viewing and processing a wide variety of multidimensional datasets. Any dataset that can be interpreted with xarray can be explored and rendered with Pan3D.


Professional Support
--------------------------------------------------------------------------

* `Training <https://www.kitware.com/courses/trame/>`_: Learn how to confidently use trame from the expert developers at Kitware.
* `Support <https://www.kitware.com/trame/support/>`_: Our experts can assist your team as you build your web application and establish in-house expertise.
* `Custom Development <https://www.kitware.com/trame/support/>`_: Leverage Kitware’s 25+ years of experience to quickly build your web application.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "trame-vtklocal",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "Python, Interactive, Web, Application, Framework",
    "author": "Kitware Inc.",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/bb/26/147676a538668c511ef067aff3247711da38f115fa6bb070686784865486/trame_vtklocal-0.7.1.tar.gz",
    "platform": null,
    "description": ".. |pypi_download| image:: https://img.shields.io/pypi/dm/trame-vtklocal\n\n========================================================\ntrame-vtklocal  |pypi_download|\n========================================================\n\nLocal Rendering using VTK.wasm to match server side rendering pipeline on the client side.\nThe current code base is still at its infancy but we aim to make it the default implementation for local rendering using VTK/ParaView with trame.\nThis WASM capability is starting to be available with VTK 9.4. \n\n.. In term of version compatibility between VTK and trame-vtklocal we aim to follow this pattern.\n.. \n.. .. list-table:: Version compatibility\n..    :widths: 50 50\n..    :header-rows: 1\n\n..    * - VTK\n..      - trame-vtklocal\n..    * - v9.4\n..      - v0\n..    * - v9.5\n..      - v1\n\nLicense\n----------------------------------------\n\nThis library is OpenSource and follow the Apache Software License\n\nInstallation\n----------------------------------------\n\n.. code-block:: console\n\n    # to install a compatible version of VTK\n    pip install \"trame-vtklocal[vtk]\"\n\n    # to install VTK yourself\n    pip install trame-vtklocal\n    pip install \"vtk>=9.4,<9.5\"\n\n\nDevelopment\n----------------------------------------\n\nBuild and install the Vue components\n\n.. code-block:: console\n\n    cd vue-components\n    npm i\n    npm run build\n    cd -\n\nInstall the library\n\n.. code-block:: console\n\n    pip install -e .\n\nOptionally, you can develop with bleeding edge VTK by following these steps. Make sure you've these tools\n\n1. git\n2. CMake\n3. Ninja\n4. Python\n5. NodeJS >= 22.0.0: https://nodejs.org/en/download/package-manager\n6. Emscripten SDK: See https://emscripten.org/docs/getting_started/downloads.html#download-and-install\n\n.. code-block:: console\n\n    # Compile VTK for wasm32 architecture using emscripten. Build artifacts can be found in dev/vtk/build/wasm\n    python ./utils/build_vtk.py -u https://gitlab.kitware.com/vtk/vtk.git -b master -t wasm32 -c RelWithDebInfo\n\n    # Compile VTK with python wrappings using system C++ compiler. Build artifacts can be found in dev/vtk/build/py\n    python ./utils/build_vtk.py -u https://gitlab.kitware.com/vtk/vtk.git -b master -t py -c RelWithDebInfo\n\n    # Windows: Set environment variables\n    ./utils/dev_environment.ps1 -b master -c RelWithDebInfo\n    \n    # Unix: Set environemt variables\n    source ./utils/dev_environment.sh -b master -c RelWithDebInfo\n\n\nRunning examples\n----------------------------------------\n\n.. code-block:: console\n\n    pip install trame \"trame-vtklocal[vtk]\" trame-vuetify trame-vtk\n\n    # regular trame app\n    python ./examples/vtk/cone.py \n\n\nSome example are meant to test and validate WASM rendering.\nSome will default for remote rendering but if you want to force them to use WASM just run `export USE_WASM=1` before executing them.\n\nSharedArrayBuffer\n----------------------------------------\n\nTo enable SharedArrayBuffer within trame you can just set the following on the server. \nThis option is not required anymore but still available if needed.\n\n.. code-block:: console\n\n    server.http_headers.shared_array_buffer = True\n\n\nThis will download the threaded WASM version. Otherwise, the non-threaded version will be used as it does not require SharedArrayBuffer.\n\n\nVTK.wasm vs trame-vtklocal\n----------------------------------------\n\nThis repository `trame-vtklocal` focus on providing a web component that is capable of mirroring a `vtkRenderWindow` defined on the server side.\nThis include a JavaScript section for the browser and a Python section for the server. \n\nThe server include a definition of a custom network protocol over our WebSocket (wslink/trame) and some helper class to ease the vtkRenderWindow binding with a web component in the browser.\nWhile the Python package include a Vue.js component for a seamless integration with trame, we also publish a `npm package <https://www.npmjs.com/package/@kitware/trame-vtklocal>`_.\nThat pure JavaScript library let you still use the trame infrastructure on the server side but with your own stack on the client side. A usage example of that pure JavaScript option is covered `in that directory <https://github.com/Kitware/trame-vtklocal/tree/master/examples/pure-js>`_.\n\nFor the pure Python trame usage, you can find the `documented API <https://trame.readthedocs.io/en/latest/trame.widgets.vtklocal.html>`_.\n\nBy design there is a nice separation between VTK.wasm and trame-vtklocal which should make trame-vtklocal fairly independent of VTK.wasm version. \nBut since we are still building capabilities, when the C++ API expend, we will also expand the Python/JavaScript component properties/methods. \nHopefully we should be able to evolve trame-vtklocal with some reasonable fallback when the version of VTK is not in par with what is exposed in trame-vtklocal.\n\nAlso most the testing of VTK.wasm is in VTK repository as many validation can be done in pure C++ or `Python <https://gitlab.kitware.com/vtk/vtk/-/tree/master/Serialization/Manager/Testing/Python>`_. \nThen we have `the WASM module API <https://gitlab.kitware.com/vtk/vtk/-/blob/master/Web/WebAssembly/vtkWasmSceneManagerEmBinding.cxx>`_  with its `node/chrome testing <https://gitlab.kitware.com/vtk/vtk/-/tree/master/Web/WebAssembly/Testing/JavaScript>`_.\n\nThe documented API of `vtkWasmSceneManager <https://vtk.org/doc/nightly/html/classvtkWasmSceneManager.html>`_ and `vtkObjectManager parent of vtkWasmSceneManager <https://vtk.org/doc/nightly/html/classvtkObjectManager.html>`_\n\nFor the moment we rely on manual testing for when we change the network and/or API at the trame-vtklocal by going over a specific set of `examples <https://github.com/Kitware/trame-vtklocal/tree/master/examples>`_.\n\nCurrently the WASM implementation is used in the following set of projects:\n\n- `Pan3D <https://github.com/Kitware/pan3d/>`_: Pan3D aims to be an utility package for viewing and processing a wide variety of multidimensional datasets. Any dataset that can be interpreted with xarray can be explored and rendered with Pan3D.\n\n\nProfessional Support\n--------------------------------------------------------------------------\n\n* `Training <https://www.kitware.com/courses/trame/>`_: Learn how to confidently use trame from the expert developers at Kitware.\n* `Support <https://www.kitware.com/trame/support/>`_: Our experts can assist your team as you build your web application and establish in-house expertise.\n* `Custom Development <https://www.kitware.com/trame/support/>`_: Leverage Kitware\u2019s 25+ years of experience to quickly build your web application.\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "VTK Local Rendering using WASM",
    "version": "0.7.1",
    "project_urls": null,
    "split_keywords": [
        "python",
        " interactive",
        " web",
        " application",
        " framework"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "53585d30ae281b9ca6148c0a20e08cb6eb449f215361e30a08de4cafd4b68c62",
                "md5": "21e40f8b0e46c73eb46685ed9d5a24f5",
                "sha256": "c2bf26dbef8560d4fbe5b9c7106ebe5cad9ddd2b6c92cdc90084c9c7229673a0"
            },
            "downloads": -1,
            "filename": "trame_vtklocal-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21e40f8b0e46c73eb46685ed9d5a24f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16749,
            "upload_time": "2025-02-13T22:36:09",
            "upload_time_iso_8601": "2025-02-13T22:36:09.198941Z",
            "url": "https://files.pythonhosted.org/packages/53/58/5d30ae281b9ca6148c0a20e08cb6eb449f215361e30a08de4cafd4b68c62/trame_vtklocal-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bb26147676a538668c511ef067aff3247711da38f115fa6bb070686784865486",
                "md5": "ce3da5dbbc19501f7391dc8db2ca2d3c",
                "sha256": "32adf39235d0c93f4b5cbc448fc0799f02c74a8ac21d275bf4aea82aec1f2552"
            },
            "downloads": -1,
            "filename": "trame_vtklocal-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ce3da5dbbc19501f7391dc8db2ca2d3c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 17336,
            "upload_time": "2025-02-13T22:36:10",
            "upload_time_iso_8601": "2025-02-13T22:36:10.850965Z",
            "url": "https://files.pythonhosted.org/packages/bb/26/147676a538668c511ef067aff3247711da38f115fa6bb070686784865486/trame_vtklocal-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-13 22:36:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "trame-vtklocal"
}
        
Elapsed time: 1.23068s