Skip to main content

Add your description here

Project description

seriallll

A small, modest Python helper for talking to serial ports. Works elsewhere via pyserial.

  • Connect with optional retries (including “retry forever”)
  • Auto-reconnect on I/O errors (e.g., cable unplug/replug)
  • Simple, thread-safe read/write helpers
  • Tiny API, single dependency

Installation

pip install seriallll
# or
uv add seriallll 

Quick start

from seriallll import SerialClient

client = SerialClient(
    port=None,           # None for auto-discover a macOS USB serial port
    baudrate=115200,
    max_retries=-1,      # retry forever on initial connect
    auto_reconnect=True, # reconnect on I/O errors
)

client.connect()
client.write_line("hello")
print(client.readline(timeout=1.0))
client.close()

Reading lines

line = client.readline(timeout=2.0)  # returns b"...\\n" or b"" on timeout

Raw read / write

client.write(b"\x01\x02\x03")
chunk = client.read(64, timeout=0.2)

Callbacks (optional)

def on_reconnect(c):
    print("Reconnected to", c.port)

client = SerialClient(port=None, on_reconnect=on_reconnect)

macOS notes

  • Auto-discovery looks for /dev/tty.usb* (and falls back to /dev/tty.*).
  • DTR (data terminal ready pin) is asserted on (re)connect, which some boards expect on macOS.

API surface

  • SerialClient.connect() / close()
  • SerialClient.write(data) / write_line(line, newline=b"\n")
  • SerialClient.read(size=1, timeout=None)
  • SerialClient.read_until(terminator=b"\n", timeout=None, max_bytes=None)
  • SerialClient.readline(timeout=None, max_bytes=None)
  • Properties: port, is_open

Troubleshooting

  • No port found: pass --port explicitly (check ls /dev/tty.* on macOS).
  • Time out reading: increase timeout or use read_until/readline.
  • Flaky cable/adapter: keep auto_reconnect=True.

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

seriallll-0.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

seriallll-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file seriallll-0.1.1.tar.gz.

File metadata

  • Download URL: seriallll-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.15

File hashes

Hashes for seriallll-0.1.1.tar.gz
Algorithm Hash digest
SHA256 63e962d99a2df4b1b4461860f0b7379646523b9f2ca7db0902b242d12904ce12
MD5 2e211d9a88aaa24adb08d2934f1d1fce
BLAKE2b-256 8fcdf3fa52e06b2b55733bbce29923e82caa5e1fbb58a2e275db05f3506916be

See more details on using hashes here.

File details

Details for the file seriallll-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: seriallll-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.15

File hashes

Hashes for seriallll-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7bdff286823ef1f0a6be1ee6c8ec4a33677b73079ce6ad73458e57c038a570
MD5 6ec026f09413e007ff63e0090f6bc3cd
BLAKE2b-256 79307dceb050adb1e26301be86b4f1ed0470ac289f5422a2f2b3ea79dd6a8540

See more details on using hashes here.

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