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

Uploaded Source

Built Distribution

anyio_serial-0.3.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anyio_serial-0.3.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for anyio_serial-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3e92c7717ad78c0adb01601ddfc35a3c0ca723ee36b5a0a95ae7b8b436065035
MD5 e455aa6e9e3db051471418319d0b8bb6
BLAKE2b-256 1fbbed5c0c486d947b522c0ec5c11a74083e7db5c28842b6a2ca64761f2a1c0b

See more details on using hashes here.

File details

Details for the file anyio_serial-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for anyio_serial-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 721cdb3abc7354fce16a55e2387c4a65565e8f122019936e9bc428f6086b37bb
MD5 f5ff607662342162f28f63e2698434bd
BLAKE2b-256 9b060a345db8699d16ea577ce420beff2003d7cb80ec62a1302cad38dfd26ae0

See more details on using hashes here.

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