Coral for python libraries
The wheel is the line between the two audiences: developers work in the uv workspace and build
wheels; end users install those wheels with pip and never touch uv.
- Development setup — developers:
uvonly, ending in the wheels. - Installation — end users:
piponly, starting from the wheels.
For working on coral-python. This is a
uv workspace: a monorepo of independently
installable packages under packages/* (coral-core, coral-app, and one coral-plugin-* per
plugin), wired together for development by the virtual root pyproject.toml and pinned in uv.lock.
- Python 3.12+
- uv installed (uv manages the interpreter and the environment —
do not use
piphere) ffmpeginstalled and onPATH(e.g.apt install ffmpeg/brew install ffmpeg) — only if you work with thephiflowplugin: required for.mp4export from the PhiFlow scripts and thephiflow_plot_and_saveworkflow node, which call matplotlib'sanim.save(..., writer='ffmpeg'). Not needed for.gifexport.
# Create .venv and install the whole workspace (incl. the dev group) from the lockfile
uv syncThat installs every workspace package editable, plugins included — so entry-point discovery finds
each coral-plugin-* straight from the checkout and coral -p "math" run … works immediately. A
developer never runs pip and never installs a plugin separately.
Then either activate the environment (source .venv/bin/activate) or prefix commands with uv run
(e.g. uv run coral --help). uv run auto-syncs the environment against uv.lock before running.
Finally, install the git hook — once per clone:
uv run pre-commit installEvery commit then runs ruff format and ruff check on the staged Python files. A formatting
failure rewrites the files: git add -u and commit again. Tests are not in the hook (no runners
yet) — run uv run pytest yourself.
# Add a runtime dependency to a specific workspace package (updates its pyproject.toml + uv.lock)
uv add --package coral-plugin-phiflow <package-name>
# Add a dev-only dependency (to the workspace root dev group)
uv add --dev <package-name>
# Re-resolve / update the lockfile and sync the environment
uv lock
uv syncEach package declares its own dependencies in its
packages/<name>/pyproject.toml(e.g.coral-plugin-phiflowownsphiflow/jax/h5py); the per-packagepyproject.tomlfiles +uv.lockare the source of truth for dependencies.
This is the hand-off point: one command produces a wheel per package into dist/. Ship that
directory (or its contents) to end users, who install it with pip as described in
Installation below. Building is only for distribution — it is not part of the
development loop, and you do not install the wheels to test your own changes.
uv build --all-packages --wheel --out-dir distFor running coral, not developing it. You need a set of coral-* wheels — either a dist/
directory handed to you, or one built as above. No uv required.
- Python 3.12+ with
pip ffmpegonPATH, as above, only if you use thephiflowplugin
The host works on its own; plugins are optional and additive.
# 1. (Recommended) create and activate a virtual environment
python3.12 -m venv .venv
source .venv/bin/activate
# 2. Install the host. `--find-links dist` lets pip resolve the internal coral-core dependency
# from the local wheels (it is not published on PyPI).
pip install --find-links dist coral-app
# 3. Optionally add plugins — each is discovered automatically and adds its own nodes:
pip install --find-links dist coral-plugin-math
pip install --find-links dist coral-plugin-string
pip install --find-links dist coral-plugin-phiflow # also pulls phiflow/jax/h5py from PyPI (heavy)coral-app alone gives a working coral CLI with the built-in primitives; every coral-plugin-*
you add is picked up via entry-point discovery. Verify with coral --help or coral register
(writes node_types.json). Then head to Usage — run coral directly.
coral is a coral-compatible CLI (the coral-app console script): a global -p/--plugin option naming the
plugins to load (comma-separated, e.g. "math,string"; empty = all installed) plus two subcommands — register
(emit the node registry) and run (execute a workflow). -p/--plugin must precede the subcommand. This mirrors
the C++ coral binary so the DealiiX platform can drive this backend via the
coral-py launcher.
Run the commands below inside the activated environment. From a pip install,
coralis onPATHonce the venv is activated; from the uv workspace, activate.venvor prefix each command withuv run(e.g.uv run coral run).
Use the run subcommand with the path to a workflow graph:
coral run path/to/your/workflow.jsonAn example phiflow workflow ships under examples/phiflow/:
coral -p "phiflow" run examples/phiflow/network-from-fe.jsonLoad specific plugins with -p/--plugin (before the subcommand):
# Load only math operations
coral -p "math" run workflow.json
# Load multiple plugins
coral -p "math,string,phiflow" run workflow.jsonDefault behavior: When -p/--plugin is omitted, all installed plugins are loaded (via entry-point
discovery). Primitives are always included. An unknown -p name fails loud with LookupError.
Available plugins (each an installed coral-plugin-* package):
phiflow- PhiFlow physics simulation wrappersmath- Mathematical operations (add,multiply,math.sqrt, etc.) andCalculatorclassstring- String processing utilities (StringProcessorclass)
Use the register subcommand. It writes node_types.json into the current directory (the filename the
DealiiX platform probes for):
coral registerGenerate the registry for specific plugins:
# Math operations only
coral -p "math" register
# Multiple plugins
coral -p "math,string,phiflow" registerCustom output filename:
coral register --output="custom_registry.json"coral --helpcoral-py runs the coral console script inside this repo's uv workspace while preserving the caller's working
directory, so register writes node_types.json into that directory. It therefore needs the
development setup (a uv checkout), not a pip install — from a pip install the platform can
point coralBinaryPath straight at the coral executable. Point the platform's coralBinaryPath at it and set
coralPluginPath to the plugin list:
./coral-py -p "math" register # writes node_types.json into the current directory
./coral-py -p "math" run workflow.jsonEach plugin is a self-contained distribution under packages/coral-plugin-*/. See
docs/ONBOARDING.md for how discovery works and how to add a new plugin.
Extending or modifying coral-python? Start with docs/ONBOARDING.md — the onboarding
guide covering goals, architecture, the two contracts with the DealiiX platform, how to add a library or
change internals, design rationale, and an honest account of strengths and weaknesses. (This README.md
is setup + commands; CLAUDE.md is the AI-assisted-development mechanics reference.)
Developer-only, and run from the workspace root: activate
.venvfirst, or prefix each command withuv run(e.g.uv run pytest). See Development setup.
Run All Tests:
pytestRun Tests with Coverage:
pytest --cov=. --cov-report=html
open htmlcov/index.html # View coverage reportRun a Specific Test File:
pytest tests/test_executor.py
pytest tests/test_integration.pyRun a Specific Test Class:
pytest tests/test_executor.py::TestPrimitiveNodeExecution
pytest tests/test_integration.py::TestPhiFlowWorkflowsRun a Specific Test Function:
pytest tests/test_executor.py::TestPrimitiveNodeExecution::test_int_primitiveRunning Specific Test Categories:
pytest -m unit # To be marked
pytest -m integration # Integration tests with Json network files
pytest -m math # Math plugin tests
pytest -m phiflow # PhiFlow tests (requires PhiFlow)
pytest -m string # String plugin testsVerbose Output:
pytest -v # Verbose
pytest -vv # Extra verbose
pytest -s # Show print statementsFor more info see the README.md in the tests directory.