/ Python SDK
Connect a Python project to a Dashwire control plane.
Register capabilities, synchronize state, receive commands, and publish logs from Python.
Overview
dashwire is the Python counterpart of @dashwire/sdk. It builds the same dashboard structure from the capabilities you register, registers the project over HTTP (POST /api/projects/:id/register), and keeps a realtime Socket.IO connection to the server's /sdk namespace for state updates, commands, actions, and logs.
The connection runs on background threads, so it works in plain scripts, workers, and web apps alike. Handlers are called from the socket thread.
Installation
Requires Python 3.9 or newer.
pip install dashwire
From a local checkout:
pip install -e packages/python-sdk
Usage
import os
from dashwire import Dashboard
dashboard = Dashboard(
id="warehouse-worker",
name="Warehouse Worker",
server_url=os.environ.get("DASHWIRE_SERVER_URL"),
token=os.environ.get("DASHWIRE_TOKEN"),
)
with dashboard.section("Runtime") as section:
section.status("health", label="Health", value="Operational", tone="success")
maintenance = section.toggle("maintenance", label="Maintenance mode", value=False)
@maintenance.on_change
def on_maintenance(enabled: bool) -> None:
print("Maintenance mode:", enabled)
terminal = section.terminal("logs", label="Logs")
dashboard.connect()
terminal.log.info("Service started")
dashboard.wait() # or dashboard.run_forever() instead of connect() + wait()
connect() blocks until the project is registered, retrying with exponential backoff (max. 30s) while the server is unreachable. Once connected, the Socket.IO client reconnects automatically and re-sends the current state after every reconnect.
Dashboard can also be used as a context manager: with Dashboard(...) as dashboard: connects on enter and disconnects on exit.
A complete example lives in examples/basic.py.
Capabilities
Register capabilities inside a section with with dashboard.section(name) as section:. All options are keyword arguments.
| Method | Purpose | Handler |
|---|---|---|
toggle(key, label, value) |
Boolean control | on_change(value: bool) |
color(key, label, value) |
Color value control | on_change(value: str) |
number(key, label, value, min, max, step, unit, writable) |
Numeric value; writable when a handler is given | on_change(value) |
slider(key, label, value, min, max, step) |
Bounded numeric slider | on_change(value) |
select(key, label, value, options) |
Select control; options are {"label", "value"} dicts or plain strings |
on_change(value: str) |
action(key, label, confirm) |
Trigger an operation | on_execute() |
status(key, label, value, tone) |
Read-only status value | — |
terminal(key, label, writable) |
Log output and optional commands | on_command(command: str) |
Every method returns a handle:
handle.value– current valuehandle.set_value(value)– update locally and push to the dashboard@handle.on_change– register a handler as a decorator (alternative to the keyword argument)terminal.log.debug/info/warn/error(message, metadata=None)– publish a log line
Other Dashboard methods: get_structure(), subscribe(listener), emit_log(level, message, source, metadata), is_connected(), disconnect().
Configuration
| Argument | Environment fallback | Default |
|---|---|---|
server_url |
DASHWIRE_SERVER_URL |
http://localhost:4000 |
token |
DASHWIRE_TOKEN, DASHWIRE_SERVER_TOKEN, SERVER_JWT |
none |
Tokens are created on the server's /security page. Do not commit production tokens to source control.
Log output uses the standard logging module under the dashwire logger.
Development
cd packages/python-sdk
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
The package also has a package.json, so the same tasks run through pnpm from the monorepo:
pnpm --filter @dashwire/python-sdk test # run the tests
pnpm --filter @dashwire/python-sdk dist # build and check the wheel + sdist
Releasing
The version lives in package.json, just like the npm packages in this repo. pyproject.toml reads it from there and dashwire.__version__ reports the installed version.
To release, bump "version" in package.json and push to main. The publish workflow sees that the version is not on PyPI yet, then tests, builds, publishes and tags it as python-sdk-v<version>.
Repository
This package is maintained in the Dashwire monorepo.
License
Licensed under the ISC License.
Metadata
Release files for dashwire 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dashwire-0.1.1.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dashwire-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.4 kB
Release files / dashwire-0.1.1.tar.gz
| Download URL | dashwire-0.1.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea6ac0421edfef8ef840b3342da738aa0c7083b2660dc5ff778e475bb158bd59
|
|
BLAKE2b-256 checksum How to use checksums |
2915bacc15d0de123e3fcdfd2da911d2855aa42b244140efe7319dd72d6e8984
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / dashwire-0.1.1-py3-none-any.whl
| Download URL | dashwire-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
972fd93527be5cfe00ee1b1c1d8dea89b89911881583e08497d06e6450706f58
|
|
BLAKE2b-256 checksum How to use checksums |
53f9c9300fd6df6a1396f572969dfd38ac37bee55917b2872b8e7dd74542216b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency log