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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: anyio_serial-0.2.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.25.1 setuptools/65.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.10.9

File hashes

Hashes for anyio_serial-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e55ab1e00d35076bd901021a7a3eacb4267d6c3606b31996f54e8cf039fb8003
MD5 ac87fd89806d1635626fc2b80c5a11f9
BLAKE2b-256 a8ce7d6e2fb5b51ee39d2502bc158265cb243a206d92dfcb50031f7232929faf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anyio_serial-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.25.1 setuptools/65.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.10.9

File hashes

Hashes for anyio_serial-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c3dbb8096463678930e7709ad194536e7849cd0f561b55bb04fc9a44c5329c
MD5 0397f1c7bbd098f8c6098bf318540509
BLAKE2b-256 dca0b0eb56b53a63b82900173de9af6822a51810d222191571e3bd7e4b81c9f0

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