Skip to main content

Asynchronous file IO for Linux MacOS or Windows.

Project description

Python wrapper for AIO

Python bindings for async file I/O on Linux and a pure-Python/thread fallback for other platforms.

Three backends are available:

Backend Kernel Notes
linux_uring ≥ 5.6 io_uring - shared ring buffers, zero-syscall completions
linux_aio ≥ 4.18 kernel AIO (io_submit / io_getevents), O_DIRECT only
thread_aio any pthreads pool, portable
python_aio any pure Python, no C extension required

Example

import asyncio
from caio import AsyncioContext

loop = asyncio.get_event_loop()

async def main():
    # max_requests=128 by default
    ctx = AsyncioContext(max_requests=128)

    with open("test.file", "wb+") as fp:
        fd = fp.fileno()

        # Execute one write operation
        await ctx.write(b"Hello world", fd, offset=0)

        # Execute one read operation
        print(await ctx.read(32, fd, offset=0))

        # Execute one fdsync operation
        await ctx.fdsync(fd)

        op1 = ctx.write(b"Hello from ", fd, offset=0)
        op2 = ctx.write(b"async world", fd, offset=11)

        await asyncio.gather(op1, op2)

        print(await ctx.read(32, fd, offset=0))
        # Hello from async world


loop.run_until_complete(main())

Selecting a backend

from caio import AsyncioContext picks the best available backend automatically (linux_uringlinux_aiothread_aiopython_aio).

To force a specific backend use the CAIO_IMPL environment variable:

CAIO_IMPL=uring   python my_app.py   # linux_uring
CAIO_IMPL=linux   python my_app.py   # linux_aio
CAIO_IMPL=thread  python my_app.py   # thread_aio
CAIO_IMPL=python  python my_app.py   # python_aio

Or import a backend directly:

# io_uring (Linux ≥ 5.6)
from caio.linux_uring_asyncio import AsyncioContext

# kernel AIO (Linux ≥ 4.18)
from caio.linux_aio_asyncio import AsyncioContext

# thread pool
from caio.thread_aio_asyncio import AsyncioContext

A default_implementation file placed next to caio/__init__.py (useful for distro package maintainers) may contain one of uring, linux, thread, or python on its first non-comment line.

Troubleshooting

io_uring blocked by seccomp

Containers (Docker, Podman, Kubernetes) often block io_uring via a seccomp filter. The import will raise ImportError with a diagnostic message if io_uring_setup(2) returns ENOSYS.

Fix:

# Docker / Podman
docker run --security-opt seccomp=unconfined ...

# Kubernetes
securityContext:
  seccompProfile:
    type: Unconfined

linux_aio compatibility

linux_aio requires kernel ≥ 4.18 and a compatible filesystem. If it does not work in your environment you can fall back to thread or python:

CAIO_IMPL=thread python my_app.py

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

caio-0.10.2.tar.gz (35.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

caio-0.10.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

caio-0.10.2-cp314-cp314-manylinux_2_34_x86_64.whl (120.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

caio-0.10.2-cp314-cp314-manylinux_2_34_aarch64.whl (122.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

caio-0.10.2-cp314-cp314-macosx_10_15_universal2.whl (38.5 kB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

caio-0.10.2-cp313-cp313-manylinux_2_34_x86_64.whl (120.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

caio-0.10.2-cp313-cp313-manylinux_2_34_aarch64.whl (122.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

caio-0.10.2-cp313-cp313-macosx_10_13_universal2.whl (38.5 kB view details)

Uploaded CPython 3.13macOS 10.13+ universal2 (ARM64, x86-64)

caio-0.10.2-cp312-cp312-manylinux_2_34_x86_64.whl (120.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

caio-0.10.2-cp312-cp312-manylinux_2_34_aarch64.whl (122.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

caio-0.10.2-cp312-cp312-macosx_10_13_universal2.whl (38.5 kB view details)

Uploaded CPython 3.12macOS 10.13+ universal2 (ARM64, x86-64)

caio-0.10.2-cp311-cp311-manylinux_2_34_x86_64.whl (117.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

caio-0.10.2-cp311-cp311-manylinux_2_34_aarch64.whl (120.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

caio-0.10.2-cp311-cp311-macosx_10_9_universal2.whl (38.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

caio-0.10.2-cp310-cp310-manylinux_2_34_x86_64.whl (118.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

caio-0.10.2-cp310-cp310-manylinux_2_34_aarch64.whl (120.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

caio-0.10.2-cp310-cp310-macosx_10_9_universal2.whl (38.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file caio-0.10.2.tar.gz.

File metadata

  • Download URL: caio-0.10.2.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for caio-0.10.2.tar.gz
Algorithm Hash digest
SHA256 83b86d3c211ac585b979494848283443f3169d04ea9a0310dec2c9d577a1fba6
MD5 ec3dcb7514fd219e972559f548d2766b
BLAKE2b-256 76153a630856c6b4a685e47abda80fe5dd2ebb89061817907ab14ac1a8380c35

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2.tar.gz:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-py3-none-any.whl.

File metadata

  • Download URL: caio-0.10.2-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for caio-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ec5bb1758ce25d81a7edf437f885437b093c01856723a3f562a83f7da43c405
MD5 0a7061587c27ecd3e20cfafdf4018516
BLAKE2b-256 f340698bba570ffca6d20096973013d4662c6bca35777c98febe05fe7d8ce799

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-py3-none-any.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cc013f587f03b2bfdcd5c10a8427ff99b8242cac646e4cc6f800ba477482bd7d
MD5 68a87777034e798f3b840c05cc6b2605
BLAKE2b-256 4e9bd2e9a1429cae6f37f92b20450fd505eec729e3b43df0d49d0903b0c5e9dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 4682d34bf006c8c348270198c51e43e769bbafecc4a71e934db9a56e5b30ac9a
MD5 debf9ae3987b8ede5b725a2c322312c5
BLAKE2b-256 13fb377d9faf2c0f9ed1d788f66c49bcb345966e164da06fffa7a962e5eb27c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp314-cp314-manylinux_2_34_aarch64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7fc7208313fb3526fe86e4e16bcb8ab76ae108554d04dc46827154aaa54dbb3d
MD5 fb648c5dae4935773f804119a5f5bdcc
BLAKE2b-256 bfae51030f3500295424de9acc0ac49bac142be79d7afb29c065e8b469f48267

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp314-cp314-macosx_10_15_universal2.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 69543346691a6e0d39f298deca160073e7e166342f8e41503ea0267a688661eb
MD5 446c44a69260a1fe452348ed85884bb9
BLAKE2b-256 10d1dfd5988e50250e6d11fac2d9da6e00e5f05de4a88b4d614b971897f8b1f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 36f88ef02a497591460f4359cdff10ff907c119e625b1f301536a9af939cfd41
MD5 5119eeb454c44a49cd9bf6cef9fe713e
BLAKE2b-256 d1446e732a572384da7f69734bcb58ba887db991edef5332970710d1126acd74

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp313-cp313-manylinux_2_34_aarch64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp313-cp313-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp313-cp313-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 ef3b2e01affb4c797f7a3b7f5138702d4e6b917e6bea27033f60482a0ee6da4b
MD5 02c8f4489a63d1ab243cdf1bc3d3e996
BLAKE2b-256 c17c36392aa9bcc292ecf6c6d2c44239df43f432e00d3a7d35e280371dee8133

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp313-cp313-macosx_10_13_universal2.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9e12b77573d244bc4d27273f6a90e40c7fc065e1478280ee1c23e621da19f9b1
MD5 93ea1142c14af936404602bec8cb4753
BLAKE2b-256 4f80f40b436a65c1fce58585172d1971f7f6395626be1f1d392cc711eeb2523b

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 c1c9a6b767f060dd6baeeba36e5ba675d68b7931893aee17cc30c02f1b05e996
MD5 eba8296b07b5473fcc2086616d701aaa
BLAKE2b-256 cf6d104a7b3583f7f4587ec41d7e749ef5a8633816b9c4e3af2a8e2898135ec4

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp312-cp312-manylinux_2_34_aarch64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp312-cp312-macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp312-cp312-macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 b36cff6e436e9802f2911da0a2d654f8355edc390d00bc404065e1e58564df45
MD5 7ad1057fae1efffcae3e6589916ab969
BLAKE2b-256 695083f391cb994ece235a9dfd84ddad223f0683c9d983231147c5c828e7c7f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp312-cp312-macosx_10_13_universal2.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4d76a9624c3dee54c4a643fe46a1e5fcd96ffb41291990a00592e7a8404dc8ad
MD5 ce2ac60cd4a0be09a9e20c6bd53aff0d
BLAKE2b-256 19f273fbbf329661eb4065618bf801b9d657c60adb7538d97397caed977c4bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp311-cp311-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3fbeac0559625ec348ec80c39765df11b3db74fd766e409d3639fbb402b3307b
MD5 4fbdc5c595e5e516f6282d86b94d65a2
BLAKE2b-256 b5cd1921e08a525ebf57d8b6a391c7d3329347403273dcc360e125f26fa21486

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp311-cp311-manylinux_2_34_aarch64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 581c47f4cb8b941eff73ccd3d1f5d79017ec6e1f9de985e46859da6391064684
MD5 75846302a5142b6c7415bd171f941670
BLAKE2b-256 b64b080040f5a67f39444ce63021483e63dc3aa2e0f119eb24e624b69a7e2653

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp311-cp311-macosx_10_9_universal2.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5fb4a77649f9c4698f6bf578a16afc84cc3882b6037aa8cb1c251e63196eedbd
MD5 dd5c57405fe0830bddbca294deddff1a
BLAKE2b-256 b716b2ba038975d21e3c373069f9e82b91a7455f121bcddf638c301decf60f01

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp310-cp310-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 2954972b909c73f5f458230e2660807db99406cdbf676dd19214a6a5b47fc36c
MD5 83d56b0e56877d68860ec8d280810faf
BLAKE2b-256 7d20872a7de9f65822ccbd27903f2a0c5e3e17c5071ac1be71acfd6161c9114f

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp310-cp310-manylinux_2_34_aarch64.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caio-0.10.2-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for caio-0.10.2-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 129c17d5b8d5972cf5a7c52e42a172d8d729b06ec9206d779247fc9a187eda07
MD5 8cd21b0bf994cdf206ed0f30518905dd
BLAKE2b-256 68b5e4eb4ddb1be322a539f6be0c7bd6dacc302ab511ec50cd3a8a1b464a07e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for caio-0.10.2-cp310-cp310-macosx_10_9_universal2.whl:

Publisher: publish.yml on mosquito/caio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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