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.3.tar.gz (6.8 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.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for seriallll-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7fe130a6a03130e60379c979a33d31ceb2782b37bd44f86961398abb3d008e93
MD5 43b0601fa0f5d557d10214494fcd7716
BLAKE2b-256 f581ebfbf9a335f1c7499553a7d920668256e0d7e501e501413a62a8cc7782c1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for seriallll-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f749ed0180f264f6709ee9c0949668c8decbddab19cba02b8335a3858062528c
MD5 eb97822a4cf966ba20b4d0a3aeb4aff0
BLAKE2b-256 44c8c541db7b6e3ec34c77c655aae4b55f35aadd8e35cf990a1b77109b9c6a52

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