Skip to content

Editor

BaseEditor

BaseEditor(options: EditorOptions)

Bases: ABC

Abstract base class for all metapipeline editor backends.

Subclasses register themselves by defining an EDITOR_NAME class attribute. Registration happens automatically at class-definition time via __init_subclass__, so a new editor becomes available as soon as its module is imported, with no changes to the dispatch logic needed.

Example::

class MyEditor(BaseEditor):
    EDITOR_NAME = "my-editor"

    def start(self): ...

Subclasses should not override __init__. All EditorOptions fields are available via self.options.

Source code in src/nf_meta/editor/base_editor.py
def __init__(self, options: EditorOptions) -> None:
    if "EDITOR_NAME" not in type(self).__dict__:
        raise TypeError(
            f"{type(self).__name__} must define EDITOR_NAME = '...' as a class attribute"
        )
    self.options = options

start abstractmethod

start() -> None

Start the editor. Should block until the user closes it.

Source code in src/nf_meta/editor/base_editor.py
@abstractmethod
def start(self) -> None:
    """Start the editor. Should block until the user closes it."""

EditorOptions dataclass

EditorOptions(editor_name: str = 'browser', host: str = '127.0.0.1', port: Optional[int] = None)

Runtime options that control how a metapipeline editor is launched.

Attributes:

Name Type Description
editor_name str

Name of the editor backend to use. Must match a key registered in base_editor._REGISTRY.

host str

Hostname or IP address the editor server binds to. Only used by server-based editors such as the browser editor.

port Optional[int]

Port the editor server listens on. When None, a free port is chosen automatically.

Built-in: browser editor

BrowserEditor

BrowserEditor(options: EditorOptions)

Bases: BaseEditor

The default editor (EDITOR_NAME = "browser"). Serves the bundled Vue single-page app via a local FastAPI backend and opens it in a browser tab once the server is reachable.

With NF_META_DEVMODE=1 set, proxies to a separately-running frontend dev server (npm run dev under editor/frontend) instead of the bundled build -- see docs/getting-started/installation.md.

Source code in src/nf_meta/editor/base_editor.py
def __init__(self, options: EditorOptions) -> None:
    if "EDITOR_NAME" not in type(self).__dict__:
        raise TypeError(
            f"{type(self).__name__} must define EDITOR_NAME = '...' as a class attribute"
        )
    self.options = options