Skip to main content

depz-sensor-viewer

A local, standalone launcher for the DEPZ sensor web viewer. It runs a tiny localhost web server that serves the viewer SPA and talks to your DEPZ sensors over pyserial — so the UI never touches the browser WebSerial API.

Why

The hosted viewer uses the browser's WebSerial API, which means:

  • a port-picker prompt every time you connect,
  • Chrome-only support, and
  • failures under some enterprise / managed-Chrome policies that disable WebSerial entirely.

This launcher sidesteps all of that. The Python process opens the serial port locally with pyserial and pipes raw bytes to the SPA over a WebSocket. No prompt, no WebSerial, works in any browser pointed at localhost.

Install & run

pipx install depz-sensor-viewer
depz-sensor-viewer

This starts the server on http://127.0.0.1:8765 (or a random free port if 8765 is taken) and opens your browser. Options:

depz-sensor-viewer --port 9000       # pick a port (0 = random free)
depz-sensor-viewer --host 127.0.0.1  # bind address (localhost by default)
depz-sensor-viewer --no-browser      # just start the server

Press Ctrl-C to stop.

Linux: serial permissions

On Linux, opening /dev/ttyACM* requires membership in the dialout group. If devices don't open, add yourself and re-login:

sudo usermod -aG dialout $USER
# then log out and back in (or: newgrp dialout)

The viewer diagnoses this for you at GET /api/permissions and shows the fix in the UI. ModemManager can also briefly grab a freshly-plugged CDC device; retry after a second, or sudo systemctl mask ModemManager if it persists.

HTTP / WebSocket contract

The bundled SPA detects standalone mode and drives devices through this fixed interface (served by depz_sensor_viewer.server):

Endpoint Response
GET /api/health {"standalone": true, "version": "<pkg>"}
GET /api/devices {"devices": [{path, usb_vid, usb_pid, serial, sensor_type, usb_model_hint}]}
GET /api/permissions {ok, os, issues, fix: {command, explanation}}
WS /ws/serial?path=<port>&baud=<n> raw byte pipe (see below)

/api/devices enumerates only ports whose USB identity is a known DEPZ device (via the SDK's USB table); it does not open the ports. baud defaults to 115200 and is nominal for the CDC-ACM devices.

/ws/serial framing:

  • client → server binary frame → serial.write(bytes)
  • server → client binary frame ← bytes read from the serial port
  • text frames carry JSON control/status:
    • server: {"opened": true, "path": ..., "baud": ...} right after open
    • server: {"error": "...", "code": "...", "fix": {...}} on failure (permission errors include the per-OS fix)
    • client: {"cmd": "set_baud", "baud": <int>} (optional)

The port is closed when the WebSocket closes.

Building the bundled SPA

The wheel ships the built SPA under depz_sensor_viewer/_static/. To (re)build it from the repo's TypeScript viewer:

python packages/depz-sensor-viewer/scripts/bundle_spa.py

This runs bun run build:spa at the repo root and copies dist-spa/client/** into _static/, materialising index.html from the prerendered SPA shell. Pass --skip-build to copy an existing dist-spa/client/ without rebuilding. Until you run it, / serves a plaintext placeholder that points here — the API endpoints above are live regardless.

The SPA build (vite.config.spa.ts) is deliberately not the default bun run build: that one targets Cloudflare and emits an SSR worker (dist/server/server.js + dist/client/) with no index.html, which the plain-file launcher cannot serve. The SSR dist/ build is left untouched, so the Cloudflare deploy keeps working.

License

MIT

Download files

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

Source Distribution

depz_sensor_viewer-0.1.6.tar.gz (454.4 kB view details)

Uploaded Source

Built Distribution

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

depz_sensor_viewer-0.1.6-py3-none-any.whl (440.4 kB view details)

Uploaded Python 3

File details

Details for the file depz_sensor_viewer-0.1.6.tar.gz.

File metadata

  • Download URL: depz_sensor_viewer-0.1.6.tar.gz
  • Upload date:
  • Size: 454.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for depz_sensor_viewer-0.1.6.tar.gz
Algorithm Hash digest
SHA256 243a73f964469303ac0d7232aadabec2f786d085537ea736765365305b3ba4b7
MD5 93dce182ed33c886eb773476110a0c8f
BLAKE2b-256 444c76f9425109fe3e2285c408c52ef6cb302b579738561bf247722de854c526

See more details on using hashes here.

Provenance

The following attestation bundles were made for depz_sensor_viewer-0.1.6.tar.gz:

Publisher: publish-viewer.yml on depz-ai/depz-sensor-sdk-and-viewer

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

File details

Details for the file depz_sensor_viewer-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for depz_sensor_viewer-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d73ad354d939bf0c60b551c4e907616f578d95311ca6cad68e9c96d25c43a0a7
MD5 621cfb273c04f32662667d8889416f21
BLAKE2b-256 8810efb6250dc02c186e0fea5340820c9d2be46bb7c1659bf9a19919b123f1c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for depz_sensor_viewer-0.1.6-py3-none-any.whl:

Publisher: publish-viewer.yml on depz-ai/depz-sensor-sdk-and-viewer

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

Release history Release notifications | RSS feed

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

This release

0.1.6 This release

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page