Quick and dirty serial bytestreams for anyio
Project description
A small Python wrapper that combines anyio and pySerial.
Implementation detail: This library is using too many short-lived threads. Yes this should be improved.
Quick start
A simple serial port reader
anyio_serial is a reasonably intuitive mash-up of pySerial and anyio’s Stream:
import anyio from anyio_serial import Serial async def main(): async with Serial(port='COM1') as port: while True: print((await port.receive()).decode(errors='ignore'), end='', flush=True) anyio.run(main)
API
anyio_serial’s interface is really simple:
from anyio_serial import Serial async with Serial(...) as port: # same options as serial.Serial ... # use "port" like any other anyio ByteStream
Attributes
The states of the serial status lines cd, cts, dsr and ri are supported.
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
anyio_serial-0.2.1.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for anyio_serial-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5c3dbb8096463678930e7709ad194536e7849cd0f561b55bb04fc9a44c5329c |
|
MD5 | 0397f1c7bbd098f8c6098bf318540509 |
|
BLAKE2b-256 | dca0b0eb56b53a63b82900173de9af6822a51810d222191571e3bd7e4b81c9f0 |