Programmatic API (Workflow, Manifest, Plugins)ο
Workflow: load YAML/JSON pipelines and run them via the CLI for full parity.Manifest: inspect packaged CLI capabilities (with optional plugin merge).plugins: register local commands for discovery (CLI help epilog + manifest overlay).
Examplesο
from zyra.workflow.api import Workflow
from zyra.manifest import Manifest
from zyra import plugins
wf = Workflow.load("samples/workflows/minimal.yml")
print(wf.describe())
run_result = wf.run(capture=True, stream=False)
assert run_result.succeeded
plugins.register_command("process", "demo_plugin", description="Local demo")
manifest = Manifest.load(include_plugins=True)
print(manifest.list_commands(stage="process"))
Notesο
Workflow execution uses subprocess calls to
zyra.clito mirror CLI behavior and logging.Plugin registry is discovery-only for now; execution dispatch remains unchanged.
A companion notebook lives at
examples/api_and_programmatic_interface.ipynbfor interactive use.
Notebook sessionsο
zyra.notebook.create_session()builds stage namespaces from the same manifest used byManifest.load().Plugins registered via
zyra.plugins.register_commandare merged into the manifest programmatically (registry overlay), and notebook sessions see them without writing files.Workflow APIs stay subprocess-based for parity, while notebook tools call callable wrappers; use whichever fits your notebook flow.
Manifest/overlay loading is centralized in
zyra.manifest_utils.load_manifest_with_overlays(honorsZYRA_NOTEBOOK_OVERLAYwhen set).To disable automatic loading of local plugins from
.zyra/extensions/plugins.py, setZYRA_DISABLE_LOCAL_PLUGINS=1.
Example:
from zyra.notebook import create_session
sess = create_session()
# Call a process tool directly from the manifest-driven namespace
sess.process.convert_format(file_or_url="/tmp/in.grib2", output="/tmp/out.tif")
# Plugins registered earlier are also discoverable
sess.process.demo_plugin()