Skip to main content

Typed Python SDK for building MiraBox Stream Dock plugins

Project description

MiraBox Stream Dock SDK for Python

Typed, unofficial Python SDK for building plugins for MiraBox Stream Dock. It implements the WebSocket protocol, registration, typed event parsing, outbound commands, per-plugin action registration, action lifecycle, plugin services, and a shared Property Inspector client.

This project is not affiliated with or endorsed by MiraBox, HotSpot, or Elgato. The connectElgatoStreamDeckSocket callback name is kept because Stream Dock uses it for Property Inspector compatibility.

Requirements

  • Python 3.11 or newer;
  • MiraBox Stream Dock 2.10.179.426 or newer;
  • Windows for packaging a Python plugin with PyInstaller.

Installation

python -m pip install mirabox-stream-dock-sdk

For SDK development:

python -m venv .venv
.venv/bin/python -m pip install -e ".[dev]"

On Windows, use .venv\Scripts\python.exe instead.

Minimal plugin

from __future__ import annotations

from dataclasses import dataclass

from mirabox_sdk import (
    Action,
    ActionRegistry,
    JsonObject,
    KeyDownEvent,
    PluginLaunchArguments,
    StreamDockPlugin,
    StreamDockSender,
    WebSocketStreamDockConnection,
    WillAppearEvent,
    run_plugin_cli,
)

ACTION_UUID = "com.example.counter.increment"


@dataclass(frozen=True, slots=True)
class Dependencies:
    stream_dock: StreamDockSender


registry: ActionRegistry[Dependencies] = ActionRegistry()


@registry.register(ACTION_UUID)
class CounterAction(Action[JsonObject, Dependencies]):
    def _render(self) -> None:
        count = self.settings.get("count", 0)
        self.set_title(str(count if type(count) is int else 0))

    def on_will_appear(self, _event: WillAppearEvent) -> None:
        self._render()

    def on_key_down(self, _event: KeyDownEvent) -> None:
        count = self.settings.get("count", 0)
        self.set_settings({"count": (count if type(count) is int else 0) + 1})
        self._render()


def build_application(arguments: PluginLaunchArguments) -> StreamDockPlugin[Dependencies]:
    connection = WebSocketStreamDockConnection(arguments.port)
    return StreamDockPlugin(
        arguments,
        stream_dock=connection,
        action_registry=registry,
        action_dependencies=Dependencies(connection),
    )


if __name__ == "__main__":
    raise SystemExit(run_plugin_cli(build_application))

The action UUID must also be declared in the plugin's manifest.json.

Property Inspector client

Copy the versioned JavaScript client into the plugin bundle:

mirabox-sdk copy-property-inspector \
  com.example.counter.sdPlugin/property-inspector

Use --force to replace a different existing copy. Include the client before the action-specific script:

<script src="mirabox-sdk.js"></script>
<script src="counter.js"></script>

The action script can use window.MiraBoxPropertyInspector:

const client = window.MiraBoxPropertyInspector;
client.on("connected", ({ settings }) => console.log(settings));
client.sendToPlugin({ event: "refresh" });
client.updateSettings({ mode: "toggle" });

Public API

  • events.py contains typed inbound event models.
  • commands.py contains outbound command models.
  • parser.py validates wire JSON and reports exact invalid field paths.
  • codecs.py converts plugin-owned settings and messages to typed objects.
  • Action and ActionRegistry model action instances and registrations.
  • StreamDockPlugin dispatches events and manages service lifecycle.
  • WebSocketStreamDockConnection implements the Stream Dock transport.
  • run_plugin_cli handles the standard executable arguments and shutdown.

The supported public surface is exported from mirabox_sdk. Other module-level objects are implementation details unless documented otherwise.

Checks

python -m unittest discover -s tests -v
python -m compileall -q src tests scripts examples
ruff check src tests scripts examples
ruff format --check src tests scripts examples
python -m build
python scripts/verify_distribution.py dist

Releasing

  1. Update the version in pyproject.toml, src/mirabox_sdk/__init__.py, and CHANGELOG.md.
  2. Run all checks and build the distributions.
  3. Create and push the matching tag, for example v0.1.0.
  4. The release workflow publishes the wheel and source archive to PyPI through Trusted Publishing and attaches them to a GitHub Release.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mirabox_stream_dock_sdk-0.1.0.tar.gz (38.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mirabox_stream_dock_sdk-0.1.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file mirabox_stream_dock_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: mirabox_stream_dock_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 38.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mirabox_stream_dock_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c9edbd61933fd2bad863a4adf011c2a1c4e49fba8107123ae1cda0a76ddc4fa
MD5 20eedb6a64cc81d93b69049444c90222
BLAKE2b-256 1acbccda15b3b9cb77d34305414656f15ad7a78a4a8a749f82da0c9158787882

See more details on using hashes here.

Provenance

The following attestation bundles were made for mirabox_stream_dock_sdk-0.1.0.tar.gz:

Publisher: release.yml on Nekit678/MiraboxStreamDockSDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mirabox_stream_dock_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mirabox_stream_dock_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4934103b51d9f748c23fc09fa30c8eb0c9ac37ef89955b164548074c4d7929b1
MD5 5a526e4d060f70149d890857ac7e8043
BLAKE2b-256 6142a7a83a0ecd6c44a07d147ac3983b22d57471db9f4096250d09504e9fb11d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mirabox_stream_dock_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on Nekit678/MiraboxStreamDockSDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page