Metadata-Version: 2.5
Name: femforge-workbench
Version: 0.1.0rc1
Summary: Interactive workbench for femforge: a trame React shell whose dock holds scene, figure and table panels over runs, artifacts, logs and lab data.
Project-URL: Homepage, https://femforge.io
Project-URL: Documentation, https://docs.femforge.io
Project-URL: Repository, https://github.com/femforge-io/femforge
Project-URL: Issues, https://github.com/femforge-io/femforge/issues
Author: Nathan W.
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: elmer,fea,finite-element,visualization,workbench
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: build123d<0.14,>=0.13
Requires-Dist: femforge[viz]==0.1.0rc1
Requires-Dist: numpy>=2.5
Requires-Dist: pandas>=3.0
Requires-Dist: platformdirs>=4.11.5
Requires-Dist: plotly>=7.1
Requires-Dist: polars<3,>=2.0
Requires-Dist: psutil>=7.2.2
Requires-Dist: pyvista[colormaps]<0.50,>=0.49.0
Requires-Dist: scipy>=1.18
Requires-Dist: trame-client>=4.1
Requires-Dist: trame-rca>=2.11.8
Requires-Dist: trame-server>=4.1
Requires-Dist: trame-vtklocal<1.8,>=1.7.1
Requires-Dist: trame>=4.0.0
Requires-Dist: vtk<9.8,>=9.7.1
Requires-Dist: watchdog>=6.0
Provides-Extra: app
Requires-Dist: pywebview>=6.2.1; extra == 'app'
Provides-Extra: ocp
Requires-Dist: ocp-vscode<4.2,>=4.1; extra == 'ocp'
Provides-Extra: pty
Requires-Dist: pywinpty>=3.0.5; (sys_platform == 'win32') and extra == 'pty'
Description-Content-Type: text/markdown

# femforge-workbench

The browser workbench for [femforge](https://pypi.org/project/femforge/): a dock of panels that browse runs and artifacts, follow solves and logs as they happen, and show the solved fields in 3D. It runs on [trame](https://kitware.github.io/trame/), and every workbench opens from a script as well as from the command line.

## Install

Install it through femforge's extra, which pins the matching version:

```console
pip install "femforge[workbench]"
```

## From a script

`femforge.workbench` holds the panels and `show`, which serves a workbench until you stop it with `Ctrl+C` or close its app window:

```python
import femforge as ff


def show_field(config: ff.SimulationConfig) -> None:
    """Solve the config, then show its flux density with the air hidden."""
    result = ff.Driver().evaluate(config)
    display = ff.DisplaySpec(field="magnetic flux density", mode=ff.DisplayMode.MAGNITUDE, hidden_bodies=("AIR",))
    ff.workbench.show(ff.workbench.field_viewer(result, display=display), title="Field", window=ff.workbench.Window.BROWSER)
```

`show` takes a built dock, or a module-level function that returns one, which it rebuilds every time you save its file. Without an argument, it opens the launcher.

## The command

```console
femforge-workbench                          # the launcher, listing every workbench
femforge-workbench field-viewer             # one workbench, by name
femforge-workbench -m lab.board:workbench   # a module attribute that returns a dock
```

| Flag | What it does |
| --- | --- |
| `--port N` | The server port, 8080 by default. |
| `--telemetry DIR` | The telemetry root the panels read. The default is `$FEMFORGE_TELEMETRY`. |
| `--persist DIR` | Where layouts and choices are saved. The default is the per-user config directory. |
| `--watch DIR` | Another directory whose saves rebuild the workbench. Repeat it for more. |
| `--app` | Open a Chrome or Edge app window, and stop the server when it closes. |
| `--webview` | Open a pywebview window. It needs the `app` extra. |
| `--dev` | Restart the server after every save to the shell itself, and reload the page. |

## Your own workbenches

A package lists its workbenches under the `femforge.workbenches` entry point group:

```toml
[project.entry-points."femforge.workbenches"]
lab = "lab.workbenches:WORKBENCHES"
```

The target is a `WorkbenchSpec` or a sequence of them, built with `panel(...)`, `script(...)` or `renderable(...)` from `femforge_workbench.registry`:

```python
from femforge_workbench.registry import panel

WORKBENCHES = [panel("board", "Board", target="lab.board:workbench", description="The board layout and its fields.")]
```

The launcher lists them beside the built-in ones, and `femforge-workbench board` opens one directly. A target resolves only when it opens, so the launcher starts without importing your models.

## Extras

| Extra | Adds | Needed for |
| --- | --- | --- |
| `app` | pywebview | the `--webview` window |
| `ocp` | ocp_vscode | sending CAD to the OCP CAD Viewer in VS Code |
| `pty` | pywinpty, on Windows only | an interactive terminal panel; without it, the terminal shows the live log read-only |

The [workbench guide](https://docs.femforge.io/user-guide/workbench/) covers the panels. The [workbench architecture](https://docs.femforge.io/contributing/architecture/workbench/) covers the widgets, the client build, the theme, reloading and persistence.
