danvas
danvas builds interactive browser UIs — dashboards, control panels, live visualizations — entirely in Python, with no HTML, JavaScript, or build step. You make panels (sliders, plots, tables, buttons, video feeds, or your own React/HTML) in Python; they appear on a zoomable browser canvas. A panel is just a face on your program: a click or edit calls a normal Python function running in your process, with full access to your code, libraries, hardware, and files — so anything you can script, you can give a UI and drive live. State flows over one WebSocket; Python owns it, the browser renders it and reports what the user did.
It's multi-user out of the box: any number of browsers — phones, tablets, or desktops — share one live canvas, with a viewer roster, live cursors, chat, and freehand drawing the host can read back. Share it across your LAN, behind a password, or over a public HTTPS tunnel — all built in, no extra services.
Install
pip install danvas
The base install is deliberately light: the serving engine is the danvasd
binary (bundled in the platform wheel, so pip install is all it takes), and the
Python side needs only websockets + orjson. Heavier features are optional
extras:
| Extra | Enables |
|---|---|
pip install "danvas[video]" |
VideoFeed JPEG encoding (OpenCV, ~90 MB) |
pip install "danvas[audio]" |
microphone capture for AudioFeed |
pip install "danvas[tunnel]" |
public sharing (serve(tunnel=True)) |
pip install "danvas[desktop]" |
native window + bake() to a standalone app |
pip install "danvas[serial]" |
python -m danvas.serial COM3 — wire a no-network device (Arduino/UART) onto a canvas |
pip install "danvas[hub]" |
run the Python reference hub python -m danvas.merge (FastAPI/uvicorn) |
canvas.video(...) needs [video] for default encoding — or stream
already-JPEG bytes with VideoFeed(encode=False), which needs nothing. For local
development, clone and pip install -e . (a checkout builds danvasd with
cargo build --release --manifest-path broker/Cargo.toml).
Hello world
import danvas
canvas = danvas.Canvas()
servo = canvas.slider("servo_1", min=0, max=180, default=90)
status = canvas.label("status", "idle")
@servo.on_change
def handle(value):
status.update(f"servo at {value}")
canvas.serve(port=8000) # opens the browser, blocks
Writing danvas code, or asking an AI to? The danvas manual is the complete reference: conventions and a one-page quick reference first, then every feature in depth. Point an assistant at it before it starts.
What's in the box
- Panels for everything: controls, tables, Plotly charts, live telemetry, heatmaps, video and audio, chat, file upload and download, a CAD/3D viewer with volume rendering, and your own React or HTML. Catalogue below.
- Your own UI, two ways:
react(...)mounts JSX natively;custom(...)drops in any HTML page —custom(path="page.html", sync=True)even shares an unedited page's controls between everyone viewing it. - Multi-user by default: a viewer roster, live cursors, chat, shared ink, and logins with roles that scope what each person sees and can do.
- Sharing built in: LAN, password, or a public HTTPS tunnel with a link that survives script restarts; widen or narrow reach live.
- Resilient: the UI survives your script crashing and heals on restart;
persist=restores values and layout across runs;danvas ps/killfinds canvases left running in the background. - Fast iteration: hot reload swaps edited function
bodies without restarting,
@canvas.on_editre-runs a function when you save it, anddescribe()/screenshot()let a script, or an AI editing it, check what it built. - Any language: one documented wire protocol; Python, Rust and Node SDKs, and an Arduino serial bridge.
The component catalogue
| Component | Direction | API |
|---|---|---|
Slider |
bidirectional | .value (read/assign), @on_change, .update(v); step= (fractional → float slider + number entry), on_release=True; live: .min, .max, .step, .color |
Toggle |
bidirectional | .value (read/assign), @on_change, .update(opt); positionals flexible: toggle(["a","b"]) or toggle("mode", ["a","b"]); live: .options, .color |
Button |
input | @on_click, .value (click count), text=, .update(text); live: .text, .color |
TextField |
bidirectional | single-line or multiline=True; @on_change on Enter/blur; .value (read/assign), .update(text), placeholder=; live: .placeholder, .color |
Label |
output | escaped text/number; .text (read/assign), .update(text); h="auto"; live: .color |
Markdown |
output | rendered Markdown; .text (read/assign), .update(text), .html (rendered) |
Image |
output | path/URL/bytes/Matplotlib/PIL/array; .src (read/assign — reads the wire-canonical data:/http URL), .update(src), .fit (read/assign); live: .color |
Table |
bidirectional | DataFrame/Series/records/dict/array → sortable, filterable, paginated; toolbar toggles index/column-visibility/row-selection (+ ✎ edit when editable=True); @on_select(indices), @on_edit(row, col, value); .selected (read/assign, silent), .update(data); each viewer's sort/filter/page survives scrolling out |
Plot |
output | .update(fig) — a Plotly figure rendered natively, with the interactive toolbar (zoom/pan/box-zoom/save-PNG on hover) |
LivePlot |
output | streaming telemetry; .push({trace: y | [y…]}, x=), .clear(), smoothing=; live: .max_points, .mode, .color |
Histogram |
output | distribution over time; .add(values, step); color= tints frame + chart |
Heatmap |
output | 2D array as a colormapped image: .update(array2d, vmin=, vmax=, cmap=, extent=, smooth=) — colorbar, cursor value readout in extent units, @on_pick clicks |
VideoFeed |
output | .update(bgr_frame) → binary JPEG; encode=False for pre-encoded |
AudioFeed |
output | .update(pcm_chunk) → Web Audio playback |
Chat |
bidirectional | shared room across viewers; .post(text), @on_message |
WebView |
output | external site in an iframe; .url (read/assign), .navigate(url) |
Model3D |
output | the 3D panel (xeokit + a WebGL2 ray marcher): .update(glb, points=, lines=, curve=, mesh_color=); named layers via .layer(name) (.points(color_by=)/.lines()/.curve()/.vectors()/.voxels()/.isosurface()/.volume()/.visible/.clear()) — orbit, mm snap measurements, section plane (cuts volumes too), X-ray/edges, NavCube + XYZ axes, MIP/Fog/Slice volume modes with window-level, per-layer Items panel, hover/@on_pick; view= starting camera + .view(preset|eye=,look=) points every viewer; shared_camera=True shares one viewer's orbit with all; .export_html(path) writes a standalone file |
FileBrowser |
bidirectional | navigate a folder (sandboxed to root=); @on_select, .value, pattern= |
Upload |
input | click/drop zone receiving a viewer's file; @on_upload, .text (read/assign), dest= (stream to disk), accept=, multiple=, max_size= |
Download |
input | button sending a host file/bytes to the viewer; source= or @provide, .text (read/assign), filename= |
Custom |
bidirectional | arbitrary HTML/CSS/JS in a sandboxed iframe; @on(event)/@on_message/@on_request/@on_binary, .push(data)/.push_binary(bytes), .update(html); themed=True, keep_mounted=True (survive scroll-out with state intact); sync=True shares any page's controls (and Plotly views) between viewers, sync="local" keeps them per viewer across culling; shared .state / @on_state; .export_html(path) |
React |
bidirectional | your JSX, compiled in-browser, theme-aware; @on(event)/@on_request/@on_binary, .update(**props), .push(data)/.push_binary(bytes), css=; shared state prop + canvas.setState / @on_state; canvas.useViewState for per-viewer state that survives culling |
Inspector |
output | live panel/globals state browser |
Most color= panels expose .color (and most accept lock/chrome flags) —
see Controlling panels live.
Your own panels
counter = canvas.react(jsx='<button onClick={() => canvas.send({n: 1})}>tap</button>')
page = canvas.custom(path="dashboard.html", sync=True) # any HTML file, shared live
@counter.on_message
def _(msg, viewer):
print(viewer["name"], "tapped")
Two bigger builds
Parametric CAD in the 3D panel (cad_model3d.py): sliders rebuild a build123d part and push mesh, point cloud, line net, isosurface and volume layers into Model3D.
A live LTspice front-end (circuit_dashboard.py): release a slider, LTspice re-simulates, and the schematic, transient, Bode plot and results redraw.
Learn more
- The danvas manual — conventions, quick reference, and every feature in depth.
- examples/ — 50 runnable scripts grouped by topic.
- PROTOCOL.md — the wire contract, for other languages and tools.
- SECURITY.md — the trust model.
Examples
python examples/hello_world.py # slider + label
python examples/frontend_backend_tour.py # interactive tour of the wire, live frame tap
python examples/sensor_dashboard.py # live VideoFeed + worker thread
python examples/show_anything.py # canvas.show() over every type
python examples/custom_html.py # hand-written bidirectional HTML panel
python examples/custom_binary_stream.py # high-rate binary telemetry (push_binary)
python examples/managed_shapes.py # managed shapes + on_draw observer
python examples/binary_stream.py # webcam → Python via canvas.requestCamera
python examples/mic_input.py # microphone → Python via canvas.requestMicrophone
python examples/react_canvas_api.py # React: canvas.viewport / setView / chat
python examples/matplotlib_panel.py # slider re-renders a matplotlib figure
python examples/plotly_panel.py # interactive Plotly chart
python examples/robot_control.py # sliders, toggle, plot, video together
python examples/download_button.py # download a host file / generated data
python examples/upload_button.py # upload a file from the browser to Python
python examples/chat_room.py # shared chat with editable names
python examples/moving_widget.py # per-viewer cursor-following emoji
python examples/public_tunnel.py # share worldwide via HTTPS tunnel
python examples/train_dashboard.py # TensorBoard-style training tracker
python examples/hackathon/hackathon.py # roles, per-team budgets, runtime teams
Notebooks: examples/notebook_dynamic.ipynb (live add/move/remove),
examples/notebook_autopanel.ipynb (cell capture),
examples/merge_canvases.ipynb (two canvases on one merge host). The
matplotlib/plotly examples need pip install matplotlib plotly.
Developing
The frontend bundle in danvas/frontend/dist/ is committed; rebuild with
cd danvas/frontend && npm install && npm run build, then
cargo build --release --manifest-path broker/Cargo.toml (the broker embeds it).
See CONTRIBUTING.md.
Licence
danvas's own source code is under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later). Commercial licences — which waive the AGPL copyleft for internal or proprietary use — are available on request via daniel.chahine004@gmail.com.
Scope. The AGPL covers danvas's own code. The pre-built frontend bundle in
danvas/frontend/dist/ is compiled from third-party packages under their
licences — all permissive (MIT), built on Preact
(the Inter typeface is under the SIL Open Font License).
See THIRD_PARTY_LICENSES.md.
No frontend licence key is required. The frontend is fully open and permissive — there is no proprietary component, no production licence key, and no watermark. Run danvas in development or production freely; only danvas's own AGPL terms apply to danvas's code.
Older releases bundled tldraw (proprietary licence, with a production key and "made with tldraw" watermark). The frontend has been rewritten to be tldraw-free, so that requirement no longer applies.
serve(tldraw_license_key=…)is accepted but ignored (kept for backwards compatibility).
Metadata
Release files for danvas 0.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| danvas-0.8.2.tar.gz | 2.5 MB | With provenance | Details for danvas-0.8.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| danvas-0.8.2-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for danvas-0.8.2-py3-none-win_amd64.whl |
| danvas-0.8.2-py3-none-manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for danvas-0.8.2-py3-none-manylinux2014_x86_64.whl |
| danvas-0.8.2-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details for danvas-0.8.2-py3-none-manylinux2014_aarch64.whl |
| danvas-0.8.2-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for danvas-0.8.2-py3-none-macosx_11_0_arm64.whl |
| danvas-0.8.2-py3-none-any.whl | Python 3 | none | any | Details for danvas-0.8.2-py3-none-any.whl |
Total release size: 30.4 MB
Release files / danvas-0.8.2.tar.gz
| Download URL | danvas-0.8.2.tar.gz |
|---|---|
| Size | 2.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f89b43c063df8a34ca2da535c6b5a23e7bd9da2ff88c3e5f44a27b0cdd47ae3
|
|
BLAKE2b-256 checksum How to use checksums |
bbae1d506ed381399462d23f73100f27f0eba7f905eee7909ef9ba72ed5a5525
|
| 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 6, 2026.
Transparency logRelease files / danvas-0.8.2-py3-none-win_amd64.whl
| Download URL | danvas-0.8.2-py3-none-win_amd64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4e1371ce22484d82f55bd0b40e602b1ce0018d0eb78fbd256741ee401e8bd93c
|
|
BLAKE2b-256 checksum How to use checksums |
cac1db4864bc89a2905df746f89dc140859b44e5a8a9fc174ef2749d0191e0be
|
| 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 6, 2026.
Transparency logRelease files / danvas-0.8.2-py3-none-manylinux2014_x86_64.whl
| Download URL | danvas-0.8.2-py3-none-manylinux2014_x86_64.whl |
|---|---|
| Size | 6.5 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
8fa1d205fc484895f5ff63bd28ff194d4e018160713d6ebdaeb0ec14fc6e1d27
|
|
BLAKE2b-256 checksum How to use checksums |
f27499d4c7c36a2a92183f0ca9f0e0e9190df517bbaa9b9aa7daac38a1caabba
|
| 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 6, 2026.
Transparency logRelease files / danvas-0.8.2-py3-none-manylinux2014_aarch64.whl
| Download URL | danvas-0.8.2-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
159001b7833c94d0173a30638ef60f02cb5643d9b84fc785c916a9fb2eef65a1
|
|
BLAKE2b-256 checksum How to use checksums |
3a2f05461e68dfe12f1f6c371455d1a078b11d313ccf089d88aed5bfce1a442b
|
| 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 6, 2026.
Transparency logRelease files / danvas-0.8.2-py3-none-macosx_11_0_arm64.whl
| Download URL | danvas-0.8.2-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.2 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7b80ac4ccd7c1d86c12b4260a6335e6d46e70d81fcc573247f4240358bdc5185
|
|
BLAKE2b-256 checksum How to use checksums |
ef83edccbed46cb4bebecadd5f67883ce36a0ca74675b5e25106e869d1e8d632
|
| 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 6, 2026.
Transparency logRelease files / danvas-0.8.2-py3-none-any.whl
| Download URL | danvas-0.8.2-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4dffaecf804319f28fb90c27beee4f9eb4f0c6593e709fda56b8028aa46e285
|
|
BLAKE2b-256 checksum How to use checksums |
4fd0d22cb7727c53c6d3c1bb87e5d1fb04a4c442473096562c313f2cfebeaea0
|
| 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 6, 2026.
Transparency logSecurity for danvas 0.8.2
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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for danvas-0.8.2.tar.gz
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 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.