Skip to content

tangram_minisky

The tangram-side frontend plugin that renders live MiniSky traffic on a tangram map.

Plugin and configuration

tangram_minisky

tangram frontend plugin rendering live traffic from a MiniSky simulator.

This package is deliberately frontend-only: it registers no API routes and runs no background services inside tangram. All simulator-side logic (unit conversion, snapshot publishing, command handling) lives in MiniSky's own TANGRAM plugin (packages/minisky-tangram/src/minisky_tangram/__init__.py in the MiniSky repo), which talks to tangram exclusively over Redis pub/sub:

  • to:<channel>:new-data full state snapshots (aviation units)
  • to:<channel>:console echoed simulator console output
  • from:<channel>:command stack commands pushed from the browser

The only thing tangram needs from this package is the compiled frontend bundle in dist-frontend and the configuration schema below.

plugin module-attribute

plugin = tangram_core.Plugin(frontend_path='dist-frontend', config_class=MiniskyConfig, frontend_config_class=MiniskyFrontendConfig, into_frontend_config_function=into_frontend)

MiniskyConfig dataclass

MiniskyConfig(channel: str = 'minisky', topbar_order: int = 45, sidebar_order: int = 45)

channel class-attribute instance-attribute

channel: str = 'minisky'

Redis channel name; must match plugins.tangram.channel in MiniSky config.

topbar_order class-attribute instance-attribute

topbar_order: int = 45

Ordering hint for the sim-control widget in tangram's topbar (lower is earlier).

sidebar_order class-attribute instance-attribute

sidebar_order: int = 45

Ordering hint for the aircraft-layer entry in tangram's sidebar (lower is earlier).

MiniskyFrontendConfig dataclass

MiniskyFrontendConfig(channel: str, topbar_order: Annotated[int, FrontendMutable()], sidebar_order: Annotated[int, FrontendMutable()])

The subset of MiniskyConfig served to the browser. topbar_order and sidebar_order are marked FrontendMutable so tangram can let the user reorder the widgets at runtime.

channel instance-attribute

channel: str

topbar_order instance-attribute

topbar_order: Annotated[int, FrontendMutable()]

sidebar_order instance-attribute

sidebar_order: Annotated[int, FrontendMutable()]

into_frontend

into_frontend(config: MiniskyConfig) -> MiniskyFrontendConfig

Lower a MiniskyConfig into the frontend-facing MiniskyFrontendConfig that tangram serves to the browser.

Source code in packages/tangram-minisky/src/tangram_minisky/__init__.py
45
46
47
48
49
50
51
52
53
def into_frontend(config: MiniskyConfig) -> MiniskyFrontendConfig:
    """Lower a [`MiniskyConfig`][tangram_minisky.MiniskyConfig] into the
    frontend-facing [`MiniskyFrontendConfig`][tangram_minisky.MiniskyFrontendConfig]
    that tangram serves to the browser."""
    return MiniskyFrontendConfig(
        channel=config.channel,
        topbar_order=config.topbar_order,
        sidebar_order=config.sidebar_order,
    )