Skip to main content

Access to IoRings for fileIO with asyncio

Project description

aioring (Io Rings for asyncio)

aioring is a library that handles async fileIO. Currently we only support io_uring on linux, other operating systems fall back to a custom ring using python threads which is only intended for development purposes and should not be used in production.

from aioring import aio

async with await aio.open("file.name", "r") as f:
  content = await f.read()

install

aioring can be installed with pip

pip install aioring

aos

in aos we expose async versions of functions defined in the 'os' module. currently we support:

  • aos.pread(fd: int, count: int, offset: int)
  • aos.pwrite(fd: int, buffer: bytes, offset: int)
  • aos.close(fd: int)
  • aos.open(path: str, flags: int, mode: int=0o777, *, dir_fd=None)
  • aos.fstat(fd: int)
  • aos.stat(path: str) these functions should work the same way as their counterpart in the os module but need to be called with await.

aio

in aio we expose a async implementation of the cpython pyio module (https://github.com/python/cpython/blob/3.10/Lib/_pyio.py) usage is like normal io but with async/await

from aioring import aio
# read file
async with await aio.open("file.txt", "r") as f:
    data = await f.read()
    
# write file
async with await aio.open("file.txt", "w") as f:
    data = await f.write("test")

Plans

  • fileIO
  • Windows IoRing
  • socketIO
  • directory operations? (io_uring currently does not support readdir)

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

aioring-0.1.2.tar.gz (300.5 kB view details)

Uploaded Source

File details

Details for the file aioring-0.1.2.tar.gz.

File metadata

  • Download URL: aioring-0.1.2.tar.gz
  • Upload date:
  • Size: 300.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for aioring-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f0d18c3b59d53ec849454372f985c0875b827e7f47fff09a8237b1bdff69b23f
MD5 e127ddf0a1adc9eb5d10c4e0cbc5da14
BLAKE2b-256 f6846845070a64b7232b6271721583f18c846d1be51d8cb76e60983f24f41776

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