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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: anyio_serial-0.2.2.tar.gz
  • Upload date:
  • Size: 4.1 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.2.tar.gz
Algorithm Hash digest
SHA256 43156df4be9c17964f9998efe8c6e72e688a0ff7ba35c2c7850400e78f51d822
MD5 f6b5aea730ef867ab87082bf9483a828
BLAKE2b-256 cfe6a06de5391514721fb226d5d16e25c73333c4f0e52f313c8285d13335bbfe

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: anyio_serial-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6338dcd1b1c8c4e59f6584a6e7feb9110291cc2e4b686f5059196d47aae9df0
MD5 fdaeb299f2a38758cbbf817bfd2417cd
BLAKE2b-256 4060d96a16a9b7b980d345c95e36a50c46132ace1db9ffe443556492cbd63d13

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