yera.apps.dataclasses

Dataclasses describing app signatures, metadata, and invocations.

Symbols

class AppInput — One parameter of an app's signature, captured as plain data.
class AppInstance — A specific invocation of an app.
class AppMetadata — Static description of an app, captured at decoration time.

AppInput

One parameter of an app's signature, captured as plain data.

Built from an inspect.Parameter when the @app decorator runs, then frozen into AppMetadata.params so the runtime, registry, and tooling can inspect the app's inputs without re-reading the function object.

Attributes

name
type: str

Parameter name.

type
type: str

String rendering of the parameter's type annotation.

kind
type: str

String rendering of the parameter kind (positional, keyword-only, etc.).

has_default
type: bool

Whether the parameter has a default value.

default_value
type: Any

The default value, or None if has_default is False.

Methods

from_parameter — Build an ``AppInput`` from an ``inspect.Parameter``.

AppInput.from_parameter

from_parameter(
    p: Parameter,
) → AppInput

Build an AppInput from an inspect.Parameter.

AppInstance

A specific invocation of an app.

An app can be called multiple times within a single run (e.g. a nested app called in a loop); each call gets a unique instance_id so events can be attributed to the right invocation.

Attributes

app_id
type: str

The app's identifier (module-qualified name).

instance_id
type: int

Counter distinguishing this invocation from other calls to the same app in the same run.

AppMetadata

Static description of an app, captured at decoration time.

Built once by the @app decorator and registered with the app registry under identifier. Used by the runtime, the console renderer, and any downstream tooling that needs to introspect apps without holding the function object.

Attributes

name
type: str

Display name (defaults to the function's __name__).

module
type: str

Fully-qualified module the app was defined in.

identifier
type: str

<module>.<name> — the unique key the registry looks the app up by.

params
type: list[AppInput]

The app's parameter list as AppInput entries.

return_type
type: str

String rendering of the declared return type.

docs
type: str | None

The wrapped function's docstring, if any.

description
type: str | None

Optional human-readable description passed to the decorator.

Methods

make_instance — Create an [`AppInstance`][yera.apps.dataclasses.AppInstance] for the ``ix``-th invocation of this app.
pretty_print — Render the app's metadata as a human-readable multi-line string.

AppMetadata.make_instance

make_instance(
    ix: int,
) → AppInstance

Create an AppInstance for the ix-th invocation of this app.

AppMetadata.pretty_print

pretty_print() → str

Render the app's metadata as a human-readable multi-line string.