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.

Fields

name
type: str (required)

Parameter name.

type
type: str (required)

String rendering of the parameter's type annotation.

kind
type: str (required)

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

has_default
type: bool (required)

Whether the parameter has a default value.

default_value
type: Any (required)

The default value, or None if has_default is False.

Methods

from_parameter — Build an application input from an inspected parameter.

AppInput.from_parameter

from_parameter(
    p: Parameter,
) → AppInput

Build an application input from an inspected parameter.

Parameters

p
type: Parameter

Function parameter to describe.

Returns

type: AppInput

A serializable description of the parameter.

AppInput.__init__

__init__(
    name: str,
    type: str,
    kind: str,
    has_default: bool,
    default_value: Any,
) → None

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.

Fields

app_id
type: str (required)

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

instance_id
type: int (required)

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

Methods


AppInstance.__init__

__init__(
    app_id: str,
    instance_id: int,
) → None

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.

Fields

name
type: str (required)

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

module
type: str (required)

Fully-qualified module the app was defined in.

identifier
type: str (required)

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

params
type: list[yera.apps.dataclasses.AppInput] (required)

The app's parameter list as AppInput entries.

return_type
type: str (required)

String rendering of the declared return type.

docs
type: str | None = None

The wrapped function's docstring, if any.

description
type: str | None = None

Optional human-readable description passed to the decorator.

Methods

make_instance — Create an application instance for one invocation.
pretty_print — Render the app's metadata as a human-readable multi-line string.

AppMetadata.make_instance

make_instance(
    ix: int,
) → AppInstance

Create an application instance for one invocation.

Parameters

ix
type: int

Invocation number within the current run.

Returns

type: AppInstance

An instance identity combining the application ID and invocation number.

AppMetadata.pretty_print

pretty_print() → str

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

Returns

type: str

A formatted summary of the application and its parameters.

AppMetadata.__init__

__init__(
    name: str,
    module: str,
    identifier: str,
    params: list[AppInput],
    return_type: str,
    docs: str | None = None,
    description: str | None = None,
) → None