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.2.tar.gz
(6.6 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.2.tar.gz.
File metadata
- Download URL: seriallll-0.1.2.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d05ef14f274db16d16250a1d57af6d71c571c6c705aa80b1136f59ea5e01e58
|
|
| MD5 |
587a596351cb964e82100c6f2ef8f2f0
|
|
| BLAKE2b-256 |
2dba3ad5dc29db5d5f6f733ccc52717cb94dbb8706640a2371a29d89d8025dc0
|
File details
Details for the file seriallll-0.1.2-py3-none-any.whl.
File metadata
- Download URL: seriallll-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1860fa026ea6521c27e8c2464be76fe1247217020cdd027405bf8b93074ed67
|
|
| MD5 |
5c6946a0f4335fe1b0ead0e280df2ac1
|
|
| BLAKE2b-256 |
82fc9a22082550e5328b49b1609ef57b7334c8c536dd31f5c5e80a6e858365aa
|