paraview-trame-components


Nameparaview-trame-components JSON
Version 0.12.1 PyPI version JSON
download
home_pageNone
SummaryMacro components for ParaView
upload_time2024-08-08 00:02:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseCopyright 2024 Kitware Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
keywords components paraview trame web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ParaView Trame Components

This project gather helper classes that can be used with ParaView to create quickly and simply web solution for interacting with your data.

## Usage example

The `./examples/` directory gather simple Python scripts using ParaView and exposing them as standalone trame applications.

## Virtual Environment setup

Since ParaView does not come with trame, you need to create a virtual environment that brings all the missing dependency for paraview to use.

```bash
# Create and activate venv
python3.10 -m venv .venv
source .venv/bin/activate

# Install published package
pip install paraview-trame-components

# Let ParaView know about the location of that venv
export PV_VENV=$PWD/.venv
```

## Running examples

```bash
# Adjust path to point to your ParaView executable
export PVPYTHON=/Applications/ParaView-5.12.0.app/Contents/bin/pvpython

# Run the scripts
$PVPYTHON --force-offscreen-rendering ./examples/cone.py
$PVPYTHON --force-offscreen-rendering ./examples/cone-with-slider.py
$PVPYTHON --force-offscreen-rendering ./examples/wavelet-contour-state.py
$PVPYTHON --force-offscreen-rendering ./examples/pipeline.py
$PVPYTHON --force-offscreen-rendering ./examples/selection.py
```

## Scripts structure

Each script add `import paraview.web.venv` at the top to enable your virtual environment via the `PV_VENV` environment variable.

Then we use the ptc (ParaView Trame Components) package to quickly create a trame application to view the data.

The `wavelet-contour-state.py` script was created by ParaView when saving its state as a Python file. Then we added few lines at the end to create an interactive web viewer.

## Check code

```bash
# one time
pip install ".[dev]"
pre-commit install

# check but automatic on commit
pre-commit run --all-files
```

## ParaView code example

```python
import paraview.web.venv
from ptc import Viewer
from paraview import simple

cone = simple.Cone()
simple.Show()
simple.Render()

# Make it a web app
web_app = Viewer()
web_app.start()
```

And if you want to add some UI

```python
import paraview.web.venv
from paraview import simple

from ptc import Viewer
from trame.widgets.vuetify3 import VSlider

cone = simple.Cone()
simple.Show()
simple.Render()

# Make it a web app
web_app = Viewer()

with web_app.side_top:
    VSlider(
        v_model=("resolution", 6),
        min=3, max=60, step=1,
    )

@web_app.state.change("resolution")
def on_resolution_change(resolution, **kwargs):
    cone.Resolution = resolution
    web_app.update()

web_app.start()
```

## Example in image

| ![Code](https://raw.githubusercontent.com/Kitware/paraview-trame-components/main/.web-app-input.png) | ![Web App](https://raw.githubusercontent.com/Kitware/paraview-trame-components/main/.web-app-output.png) |
| :-------------------------: |  :----------------------------: | 
| Write some python code      |  And get a web app              | 
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "paraview-trame-components",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Sebastien Jourdain <sebastien.jourdain@kitware.com>",
    "keywords": "components, paraview, trame, web",
    "author": null,
    "author_email": "Sebastien Jourdain <sebastien.jourdain@kitware.com>",
    "download_url": "https://files.pythonhosted.org/packages/e4/d7/9efc58a1f1fa0ffd49bcc37e713039ce8fc2acbf7fea36f04bd2e4ffca89/paraview_trame_components-0.12.1.tar.gz",
    "platform": null,
    "description": "# ParaView Trame Components\n\nThis project gather helper classes that can be used with ParaView to create quickly and simply web solution for interacting with your data.\n\n## Usage example\n\nThe `./examples/` directory gather simple Python scripts using ParaView and exposing them as standalone trame applications.\n\n## Virtual Environment setup\n\nSince ParaView does not come with trame, you need to create a virtual environment that brings all the missing dependency for paraview to use.\n\n```bash\n# Create and activate venv\npython3.10 -m venv .venv\nsource .venv/bin/activate\n\n# Install published package\npip install paraview-trame-components\n\n# Let ParaView know about the location of that venv\nexport PV_VENV=$PWD/.venv\n```\n\n## Running examples\n\n```bash\n# Adjust path to point to your ParaView executable\nexport PVPYTHON=/Applications/ParaView-5.12.0.app/Contents/bin/pvpython\n\n# Run the scripts\n$PVPYTHON --force-offscreen-rendering ./examples/cone.py\n$PVPYTHON --force-offscreen-rendering ./examples/cone-with-slider.py\n$PVPYTHON --force-offscreen-rendering ./examples/wavelet-contour-state.py\n$PVPYTHON --force-offscreen-rendering ./examples/pipeline.py\n$PVPYTHON --force-offscreen-rendering ./examples/selection.py\n```\n\n## Scripts structure\n\nEach script add `import paraview.web.venv` at the top to enable your virtual environment via the `PV_VENV` environment variable.\n\nThen we use the ptc (ParaView Trame Components) package to quickly create a trame application to view the data.\n\nThe `wavelet-contour-state.py` script was created by ParaView when saving its state as a Python file. Then we added few lines at the end to create an interactive web viewer.\n\n## Check code\n\n```bash\n# one time\npip install \".[dev]\"\npre-commit install\n\n# check but automatic on commit\npre-commit run --all-files\n```\n\n## ParaView code example\n\n```python\nimport paraview.web.venv\nfrom ptc import Viewer\nfrom paraview import simple\n\ncone = simple.Cone()\nsimple.Show()\nsimple.Render()\n\n# Make it a web app\nweb_app = Viewer()\nweb_app.start()\n```\n\nAnd if you want to add some UI\n\n```python\nimport paraview.web.venv\nfrom paraview import simple\n\nfrom ptc import Viewer\nfrom trame.widgets.vuetify3 import VSlider\n\ncone = simple.Cone()\nsimple.Show()\nsimple.Render()\n\n# Make it a web app\nweb_app = Viewer()\n\nwith web_app.side_top:\n    VSlider(\n        v_model=(\"resolution\", 6),\n        min=3, max=60, step=1,\n    )\n\n@web_app.state.change(\"resolution\")\ndef on_resolution_change(resolution, **kwargs):\n    cone.Resolution = resolution\n    web_app.update()\n\nweb_app.start()\n```\n\n## Example in image\n\n| ![Code](https://raw.githubusercontent.com/Kitware/paraview-trame-components/main/.web-app-input.png) | ![Web App](https://raw.githubusercontent.com/Kitware/paraview-trame-components/main/.web-app-output.png) |\n| :-------------------------: |  :----------------------------: | \n| Write some python code      |  And get a web app              | ",
    "bugtrack_url": null,
    "license": "Copyright 2024 Kitware Inc.  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.",
    "summary": "Macro components for ParaView",
    "version": "0.12.1",
    "project_urls": null,
    "split_keywords": [
        "components",
        " paraview",
        " trame",
        " web"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22f2da42aeb67c7edbb2a3a27bb7bb8ace6a4faa195f87b56daf6dc1bf18730d",
                "md5": "e3200d3d9a306fc8708fce0cd19dc533",
                "sha256": "45209977d83356f9231cb310d90a2e0ada6d641d0a07aff1581a78d11674a772"
            },
            "downloads": -1,
            "filename": "paraview_trame_components-0.12.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3200d3d9a306fc8708fce0cd19dc533",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 24904,
            "upload_time": "2024-08-08T00:02:55",
            "upload_time_iso_8601": "2024-08-08T00:02:55.843050Z",
            "url": "https://files.pythonhosted.org/packages/22/f2/da42aeb67c7edbb2a3a27bb7bb8ace6a4faa195f87b56daf6dc1bf18730d/paraview_trame_components-0.12.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4d79efc58a1f1fa0ffd49bcc37e713039ce8fc2acbf7fea36f04bd2e4ffca89",
                "md5": "565a06bd26a4d58b7c74e04ec01cbc14",
                "sha256": "f91ec028dc11d9dd6953271d77a78d776c4fd7024b566d8c031e99a03ba40d3e"
            },
            "downloads": -1,
            "filename": "paraview_trame_components-0.12.1.tar.gz",
            "has_sig": false,
            "md5_digest": "565a06bd26a4d58b7c74e04ec01cbc14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 21118,
            "upload_time": "2024-08-08T00:02:57",
            "upload_time_iso_8601": "2024-08-08T00:02:57.488428Z",
            "url": "https://files.pythonhosted.org/packages/e4/d7/9efc58a1f1fa0ffd49bcc37e713039ce8fc2acbf7fea36f04bd2e4ffca89/paraview_trame_components-0.12.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-08 00:02:57",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "paraview-trame-components"
}
        
Elapsed time: 0.31035s