paraview-trame-components


Nameparaview-trame-components JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryMacro components for ParaView
upload_time2024-04-23 00:21:06
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_width_slider.py
$PVPYTHON --force-offscreen-rendering ./examples/wavelet-contour-state.py
$PVPYTHON --force-offscreen-rendering ./examples/pipeline.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/94/8a/25cf23eb5e25afc9311406340a26b848c9ad83927445ead4e133707e505a/paraview_trame_components-0.6.0.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_width_slider.py\n$PVPYTHON --force-offscreen-rendering ./examples/wavelet-contour-state.py\n$PVPYTHON --force-offscreen-rendering ./examples/pipeline.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.6.0",
    "project_urls": null,
    "split_keywords": [
        "components",
        " paraview",
        " trame",
        " web"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab4aebfa71e0002a969cfe0fcde40add192dc269683b1cb918e089e84a498ce1",
                "md5": "24a73f41379c2801039dd6084c6453ed",
                "sha256": "78f88d34038cd88adf128e3521acad0ca6a2aab4246307737864d6fc170bd7ba"
            },
            "downloads": -1,
            "filename": "paraview_trame_components-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "24a73f41379c2801039dd6084c6453ed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 13102,
            "upload_time": "2024-04-23T00:21:05",
            "upload_time_iso_8601": "2024-04-23T00:21:05.132528Z",
            "url": "https://files.pythonhosted.org/packages/ab/4a/ebfa71e0002a969cfe0fcde40add192dc269683b1cb918e089e84a498ce1/paraview_trame_components-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "948a25cf23eb5e25afc9311406340a26b848c9ad83927445ead4e133707e505a",
                "md5": "d52bf3cec832b075455fb7daa94e77c0",
                "sha256": "871aa800404d8eaba40dd43327c5a7761e630c9074239837e091e3e5767e37ea"
            },
            "downloads": -1,
            "filename": "paraview_trame_components-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d52bf3cec832b075455fb7daa94e77c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 12103,
            "upload_time": "2024-04-23T00:21:06",
            "upload_time_iso_8601": "2024-04-23T00:21:06.905152Z",
            "url": "https://files.pythonhosted.org/packages/94/8a/25cf23eb5e25afc9311406340a26b848c9ad83927445ead4e133707e505a/paraview_trame_components-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 00:21:06",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "paraview-trame-components"
}
        
Elapsed time: 0.23685s