Skip to main content

License: Apache 2.0

uarthub

Share one serial port with multiple people over TCP — pure Python, zero config.

A serial device can only be opened by one process at a time, which makes collaborative debugging awkward: whoever grabbed the port first owns it, and everyone else waits. uarthub solves this by owning the device once and bridging it to any number of TCP clients. Everyone sees the same serial output, anyone can type commands, and clients join and leave freely without disturbing each other.

uarthub architecture

Cross-platform: Linux, Windows (COM*), and macOS (/dev/tty.usbmodem*) all work. Serial device path is whatever your system exposes — /dev/ttyACM*, /dev/ttyUSB*, /dev/ttyS*, a pty, anything pyserial can open. uarthubd is the only process that holds the device; clients talk to it over TCP and never touch the port directly.

Features

  • Multi-client broadcast — serial output goes to every client (and to the host's own stdout)
  • Everyone can send — input from any client is forwarded verbatim to the device
  • Join/leave anytime — a client disconnecting (Ctrl-C in uarthub, the intended way) disturbs the others or the device connection
  • Pure Python, zero config — a single command; the dependencies are pyserial, argcomplete (shell Tab completion for -u) and questionary (the server-selection menu)

Install

pip install uarthub          # or: pipx install uarthub

Or run straight from a checkout, no install needed:

./main.py --help

Usage

The one-command flow — just run uarthub on the machine with the device attached; it starts a background daemon itself if none is running, and that daemon exits by itself once every client has disconnected:

uarthub                      # auto-detects the serial port, auto-starts a server if needed
uarthub /dev/ttyACM3         # shorthand: a /dev/ path as the positional arg
uarthub COM3                 # same shorthand on Windows
uarthub -u /dev/ttyACM0 -b 921600           # which device the server should open
uarthub -u /dev/ttyUSB0                      # any serial path works (ttyACM* / ttyUSB* / COM*)

An explicit daemon never exits on its own and is the right choice for a shared lab machine:

uarthubd /dev/ttyACM1 --port 7000             # manual server, stays up (921600 default)
uarthubd /dev/ttyACM1 115200 --auto-exit      # exits 2s after the last client leaves

Anyone — on the same machine or over the network — connects from their own terminal:

uarthub                     # auto-discovers running servers, connects if only one
uarthub <hub-host>          # same, on a remote machine
uarthub -p 7001             # explicit port: connect directly, no discovery

With several servers running, uarthub lists them (device + port + baud) in an arrow-key menu and connects to the one you pick; passing -u <device> jumps straight to the server already holding that device; if none holds it, a new server is started for it on the next free port (never hijacking an existing server for a different device). Discovery probes TCP ports 7000-8099 (parallel, sub-second on localhost); -p bypasses it entirely.

Daemon arguments:

Argument Default Description
uart auto-detect serial device path (with multiple ports, one must be passed explicitly)
baud 921600 baud rate
--host 0.0.0.0 TCP listen address
-p, --port 7000 TCP listen port
--auto-exit off exit 2s after the last client disconnects

Client arguments:

Argument Default Description
host 127.0.0.1 host running uarthubd
-p, --port auto-discover TCP port (scans 7000-8099; falls back to 7000)
-u, --uart auto-detect device for the auto-started server; with discovery, jumps to the server holding it
-b, --baud 921600 baud rate for the auto-started server (local only)

Connected clients immediately start receiving serial output and can type commands. Ctrl-C exits the client; the daemon and other clients are unaffected. Multiple people can be connected at the same time; when two people type simultaneously the bytes simply interleave, so agree on who drives.

telnet <hub-host> 7000 or nc <hub-host> 7000 work too — uarthub is just a client that exits the way you expect.

Development

pip install -e ".[dev]"   # pytest, ruff, build, twine
pytest                    # runs from src/ via pythonpath, no install needed
ruff check src tests main.py

The test suite exercises the full broadcast/send/disconnect behavior against a pty-backed fake device — no real hardware required.

How it works

uarthub opens the serial device with pyserial and runs a small asyncio server. Serial output is offered to every connected client; input from any client is written to the device. One owner, N observers.

License

This project is licensed under the Apache License, Version 2.0.

See LICENSE or https://www.apache.org/licenses/LICENSE-2.0 for the full text.

Metadata

Release files for uarthub 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uarthub 0.0.5
File Size Uploaded Provenance Actions
uarthub-0.0.5.tar.gz 21.7 kB Without provenance Details for uarthub-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uarthub 0.0.5
File Interpreter ABI Platform Actions
uarthub-0.0.5-py3-none-any.whl Python 3 none any Details for uarthub-0.0.5-py3-none-any.whl

Total release size: 38.7 kB

Release files / uarthub-0.0.5.tar.gz

Download URL uarthub-0.0.5.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8f6ba23f7187905423fc2fc54b7bc8fb1af5777d0b036e68dfe54834c41166fe
BLAKE2b-256 checksum
How to use checksums
54de315aa71a8363684a8acadfec6cb26affeafa79d2782f6ddc5ebdc9943b83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / uarthub-0.0.5-py3-none-any.whl

Download URL uarthub-0.0.5-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65ecea720716f0d630d5f9357aa34b75d5d2de6a94019a1be7c0bc218e5a0fc3
BLAKE2b-256 checksum
How to use checksums
bcf0294213a46d71d4e5565eb41643a865c653a35218fc5de91868e2ec6c5a8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for uarthub 0.0.5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files No provenance

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