Skip to main content

Asynchronous file IO for Linux MacOS or Windows.

Project description

Python bindings for Linux AIO API and simple asyncio wrapper.

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())

Troubleshooting

The linux implementation works normal for modern linux kernel versions and file systems. So you may have problems specific for your environment. It’s not a bug and might be resolved some ways:

  1. Upgrade the kernel

  2. Use compatible file system

  3. Use threads based or pure python implementation.

The caio since version 0.7.0 contains some ways to do this.

1. In runtime use the environment variable CAIO_IMPL with possible values:

  • linux - use native linux kernels aio mechanism

  • thread - use thread based implementation written in C

  • python - use pure python implementation

2. File default_implementation located near __init__.py in caio installation path. It’s useful for distros package maintainers. This file might contains comments (lines starts with # symbol) and the first line should be one of linux thread or python.

Previous versions allows direct import of the target implementation.

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

Uploaded Source

Built Distributions

caio-0.9.16-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

caio-0.9.16-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (81.7 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

caio-0.9.16-cp312-cp312-macosx_10_9_universal2.whl (37.9 kB view details)

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

caio-0.9.16-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (80.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

caio-0.9.16-cp311-cp311-macosx_10_9_universal2.whl (37.8 kB view details)

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

caio-0.9.16-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (79.4 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

caio-0.9.16-cp310-cp310-macosx_10_9_universal2.whl (37.8 kB view details)

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

caio-0.9.16-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78.7 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

caio-0.9.16-cp39-cp39-macosx_10_9_universal2.whl (37.8 kB view details)

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

caio-0.9.16-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (79.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64 manylinux: glibc 2.17+ x86-64

caio-0.9.16-cp38-cp38-macosx_11_0_universal2.whl (38.0 kB view details)

Uploaded CPython 3.8 macOS 11.0+ universal2 (ARM64, x86-64)

File details

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

File metadata

  • Download URL: caio-0.9.16.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for caio-0.9.16.tar.gz
Algorithm Hash digest
SHA256 a1efcf4375eab98faf3c7f7563c9f4e9b9020ec3e3076475239a79e05a921fe6
MD5 1e22fcd60e5e4f6eb3957ca820fabadc
BLAKE2b-256 9f0bc9310f275790bf49a27c8ca3f490ebfde3c7ae89038462ed8feffffdc3e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.16-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for caio-0.9.16-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8b9b1006a9cf3f5179e67122d12456d001a15ff04b6f5222a0483a0856d6d5
MD5 6823a4e9a8bdc19102d9e8287e6681db
BLAKE2b-256 f3d67d7f15362ba5f89ce5da04cf1d04c70c065f2c6b80aedff101899ffd6a20

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fc695da9765119810da327661f3a85da0cf1fd877ccbc9d50bbf70a5119c513
MD5 612ea899ce8fd3717457b8d989dab965
BLAKE2b-256 cecb3c47820f4e81ed901508663705baca6132777eb486e84277d0043643e9ec

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a9909d1846df58e6e2a966354dd628c32ab52089d7128c38b34ce851373d13cb
MD5 9070f318e2248ca9e89733f0a265ddc8
BLAKE2b-256 5927a465c38c256574bd7bc1c722f6ae6b08654125feb1027998febfc4d72df4

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 975341ec6bcab3735db678651308ea45fefd970179a9f1f3994b4f3a6c3b8e3c
MD5 56d90b4ffa2c78eac6194651785c412e
BLAKE2b-256 78c3bd2b47b2655850c7fc6ac184e7bbd65b8d48ab861fa7dc2506fac2208730

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.16-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3fdfcf900125640bca9e5526387037f13c0d28d1a6f40834fa1ac8b8a9fb44b1
MD5 a123b3663b60b2fb95565f9eda79cd94
BLAKE2b-256 89f28ad8798200e21f7be0d56a168058ac45e047d7c4d187137067a5efc9ccd9

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ac716715e22e9f65b323030ab07f137ea2719790459abc0bc9156a5d34bca0c5
MD5 589f94e1622b1d94b19a36855b25d31a
BLAKE2b-256 dfbc1b383c31a601b850426e1ec3c2d771389c45f7fcfe5e0c73111d94615a49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.16-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b3c07e29846662c690db83f9a9fda8ce8a8d0012acdd4f2ff2ec269fa388e6dd
MD5 77ead53095714e5f38e4d798018cea5d
BLAKE2b-256 43a198587553b81f0b74d6738e25e3baf7dca288d2d30db32c1193dcbee3ce11

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 359ff5987b55eb6fd4b20b13c599f3c2b6d6ba8713fd0fefa35cd9a93214793a
MD5 c7fb93c2648fe8217f387cc0cc2546f2
BLAKE2b-256 4d0c653a4dc851d82864553a003a5be1d719e0cf1c6cb378330d175321bc9816

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 cf54c4d39bd4bf067ecf2ee7b8f711fc3a43ff84f4723678b386be41790812ee
MD5 bdaa69f7eebfd07c7eddb40d8d8e1403
BLAKE2b-256 3ef5e517deb4ddcbf3f148c829b4f27e2c954f83e4327810d530f64221a166b2

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f237db0f3536ac61b4a60a0c989500798a7b31fcf2331960584c54fb5323259
MD5 0f5d72c12a7378b2ef50f060214f306c
BLAKE2b-256 b276dc075cefb47bab399acf05aa3977e83263a74366d85bbbf619b801eb012f

See more details on using hashes here.

File details

Details for the file caio-0.9.16-cp38-cp38-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for caio-0.9.16-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 91ee6147ec435283f7f4c68311b5d75332d2a20f940e3681bbe9d697a3231189
MD5 58d273babc9fe9205462ba880884f14d
BLAKE2b-256 7911b7d32faa9e2045c2cb47fdc4634a3270354d8d38407c7d1d238d4c89afeb

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