Skip to main content

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


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

Uploaded Source

File details

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

File metadata

  • Download URL: anyio_serial-0.1.5.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.21.0 setuptools/52.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.9.1+

File hashes

Hashes for anyio_serial-0.1.5.tar.gz
Algorithm Hash digest
SHA256 757d13f205d074c1e140851808095311b4034d16246e67760166ead526d8793f
MD5 5bc3e5b90d6eec13278666207e033d5c
BLAKE2b-256 0ba3e6b9ac777a843f5c43f877a635ed5e148f9996221366e6b57b4d741cc61a

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