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
--portexplicitly (checkls /dev/tty.*on macOS). - Time out reading: increase
timeoutor useread_until/readline. - Flaky cable/adapter: keep
auto_reconnect=True.
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe130a6a03130e60379c979a33d31ceb2782b37bd44f86961398abb3d008e93
|
|
| MD5 |
43b0601fa0f5d557d10214494fcd7716
|
|
| BLAKE2b-256 |
f581ebfbf9a335f1c7499553a7d920668256e0d7e501e501413a62a8cc7782c1
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f749ed0180f264f6709ee9c0949668c8decbddab19cba02b8335a3858062528c
|
|
| MD5 |
eb97822a4cf966ba20b4d0a3aeb4aff0
|
|
| BLAKE2b-256 |
44c8c541db7b6e3ec34c77c655aae4b55f35aadd8e35cf990a1b77109b9c6a52
|