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

Uploaded Source

Built Distribution

anyio_serial-0.3.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for anyio_serial-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6ccc24b717dd943d692b0cdf221081ae0d1c5e3cbe2cf456c0bebd54601b7d8e
MD5 c0f8df9161ce1e5a1a88d51e7279e6c6
BLAKE2b-256 ec0ae6bd8b5ae39038e699f97266abc5a5099e0bb30cb43936bf34b516398250

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anyio_serial-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for anyio_serial-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 702a75b218d0536021beecc3cdecf2bdbb5c962b79af312da96b7919da4b43e2
MD5 eca2c824ce06183d08facecbeaff10c6
BLAKE2b-256 50c023b76d1c7c52872ee0a01a3f8948c9de7db20ab3164560029d72529525ca

See more details on using hashes here.

Supported by

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