yera.runtime.publisher

Provides publisher abstractions for streaming str (HTMX chunk) content.

Symbols

class BasePublisher — Abstract base class for all publisher implementations.
class Publisher — An asynchronous publisher that queues fragments for consumption via an async iterator.
class ReplayPublisher — A Publisher-shaped sink that collects fragments synchronously for replay.
class WebRenderContext — The web-transport context handlers render against.

BasePublisher

Inherits: ABC

Abstract base class for all publisher implementations.

Methods

push — Pushes a chunk of data to the sink.
push_eof — Signals that the end of the stream has been reached.
push_pause — Signals a temporary pause in the data stream.

BasePublisher.push

push(
    chunk: str,
) → None

Pushes a chunk of data to the sink.

Parameters

chunk
type: str

The string fragment to be published.

BasePublisher.push_eof

push_eof() → None

Signals that the end of the stream has been reached.

BasePublisher.push_pause

push_pause() → None

Signals a temporary pause in the data stream.

Publisher

Inherits: BasePublisher

An asynchronous publisher that queues fragments for consumption via an async iterator.

Methods

push — Thread-safely pushes a chunk into the async queue.
push_eof — Thread-safely pushes the EOF sentinel into the async queue.
push_pause — Thread-safely pushes the PAUSE sentinel into the async queue.
stream — Yields fragments until EOF, leaving EOF in place for later readers.

Publisher.push

push(
    chunk: str,
) → None

Thread-safely pushes a chunk into the async queue.

Parameters

chunk
type: str

The string fragment to publish.

Publisher.push_eof

push_eof() → None

Thread-safely pushes the EOF sentinel into the async queue.

Publisher.push_pause

push_pause() → None

Thread-safely pushes the PAUSE sentinel into the async queue.

Publisher.stream

stream() → AsyncIterator[str | object]

Yields fragments until EOF, leaving EOF in place for later readers.

ReplayPublisher

Inherits: BasePublisher

A Publisher-shaped sink that collects fragments synchronously for replay.

Methods

push — Appends a chunk to the internal collection.
push_eof — No-op: replay collects a bounded list, no EOF sentinel.
push_pause — No-op: replay supplies its own close after the collected frames.

ReplayPublisher.push

push(
    chunk: str,
) → None

Appends a chunk to the internal collection.

Parameters

chunk
type: str

The string fragment to collect.

ReplayPublisher.push_eof

push_eof() → None

No-op: replay collects a bounded list, no EOF sentinel.

ReplayPublisher.push_pause

push_pause() → None

No-op: replay supplies its own close after the collected frames.

WebRenderContext

The web-transport context handlers render against.

Attributes

publisher
type: BasePublisher

The publisher instance used to push content.

input_url
type: str

The URL associated with the current prompt.