composeui.core.registry

Map abstract renderer keys to each backend’s concrete renderer classes.

Adding a backend means adding one RendererType member here, with its extra, one RENDERERS mapping in the backend’s renderers module, and APPLICATION/MODEL_APPLICATION in its application module.

class composeui.core.registry.Backend[source]

Bases: NamedTuple

A backend’s modules, by dotted path: none is imported until the backend is used.

renderers: str

exposes the RENDERERS mapping

applications: str

exposes APPLICATION and MODEL_APPLICATION, the backend’s application classes

extra: str

the package’s extra that installs what the backend imports, e.g. "web"

packages: tuple[str, ...]

the top-level modules the extra installs: run names those missing

static __new__(_cls, renderers, applications, extra, packages)

Create new instance of Backend(renderers, applications, extra, packages)

Parameters:
class composeui.core.registry.RendererType[source]

Bases: Enum

A renderer backend, identified by its modules.

QT = ('composeui.qtcore.qtrenderer', 'composeui.qtcore.qtapplication', 'pyside6', ('PySide6', 'pyqtgraph', 'qtpy'))
TEXTUAL = ('composeui.textualcore.textualrenderer', 'composeui.textualcore.textualapplication', 'tui', ('textual', 'textual_fspicker', 'textual_plotext'))
WEB = ('composeui.webcore.webrenderer', 'composeui.webcore.webapplication', 'web', ('itsdangerous', 'markdown_it', 'markupsafe', 'python_multipart', 'starlette', 'uvicorn'))
composeui.core.registry.create_renderer(renderer_type, key, view)[source]

Create the renderer registered under key by renderer_type’s backend.

Returns None when the backend doesn’t register key, meaning it doesn’t support that widget: the view is then not rendered.

Parameters:
Return type:

Renderer[Any, Any] | None