These docs describe unreleased changes on main. See the latest release.

rlmesh.View

classfrom rlmesh import View[source]

How to show a live eval. Pass to run / session as view=.

View(
    backend: str = 'terminal',
    port: int = 8008,
    fps: int = 30,
    source: str | None = None,
    format: str = 'jpeg',
    quality: int = 75,
    hold: bool | float = False,
    step_hz: float | None = None,
)

The common cases are the string shorthands "terminal" / "http" / "http:9000" / "both"; construct a View directly only to tune.

backend

attribute[source]
backend: str

Where to draw – "terminal" (in-place half-blocks), "http" (a local web page), or "both".

port

attribute[source]
port: int

HTTP port for the "http" / "both" backends.

fps

attribute[source]
fps: int

Target frame rate; frames produced faster are dropped. This only thins the drawing: the eval itself still runs flat out (see step_hz).

source

attribute[source]
source: str | None

Which source to show first by label (a render label or an image role); None shows the env’s first declared image role, or its render() frame when it declares none.

format

attribute[source]
format: str

Encoding for HTTP frames, "jpeg" or "png".

quality

attribute[source]
quality: int

JPEG quality 1..100 (ignored for PNG).

hold

attribute[source]
hold: bool | float

Keep the viewer up after the session ends, showing the final frame and HUD: True until you quit it (q / Esc in the terminal, the quit button on the HTTP page, or Ctrl-C), a number of seconds to hold at most that long. False (the default) closes the viewer with the session. The hold follows only a session that ended normally: one closing on an error or KeyboardInterrupt skips it and raises at once. An unbounded hold needs someone to quit it: with no interactive terminal (stdin not a tty, as in CI; the terminal backend also needs stdout to be one) it is skipped with a warning rather than blocking forever, on every backend. A number of seconds is bounded and holds regardless.

step_hz

attribute[source]
step_hz: float | None

Pace the session’s env steps to at most this many per second, so a fast sim plays back at a watchable rate (set it to the env’s control rate for real time). The session sleeps after each step until the next step is due; a step slower than the period is never sped up, and the lost time is not made up with a burst. None (the default) runs as fast as it can.