Skip to main content

Quick and dirty serial bytestreams for anyio

Project description

A small Python wrapper that combines [anyio](https://anyio.readthedocs.io) and [pySerial](https://pypi-hypernode.com/project/pyserial/).

Implementation detail: This library is using too many short-lived threads. Yes this should be improved.

Quick start

A simple serial port reader

::

import anyio from anyio_serial import Serial

async def read_and_print(port: Serial):
while True:

print((await port.read).decode(errors=’ignore’), end=’’, flush=True)

async def main():
async with Serial(port=’COM1’) as port:

await read_and_print(port)

anyio.run(main)

API

Serial

::

from anyio_serial import Serial

Constructor

::
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


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.0.0.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file anyio_serial-0.0.0.tar.gz.

File metadata

  • Download URL: anyio_serial-0.0.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for anyio_serial-0.0.0.tar.gz
Algorithm Hash digest
SHA256 b22dbddb1cbc10bfdc99a68255957256fae60c12e436ee75fb6b49812e2326d3
MD5 5d627f7b08d31e78686b32c08e702af5
BLAKE2b-256 66b3d06bb0779e8763fe610ce13b2c5c30735b20ab3b979c918f32e9e903ef28

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page