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

Uploaded Source

Built Distributions

caio-0.9.10-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

caio-0.9.10-cp311-cp311-macosx_10_9_universal2.whl (38.3 kB view details)

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

caio-0.9.10-cp310-cp310-macosx_10_15_x86_64.whl (30.6 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

caio-0.9.10-cp39-cp39-macosx_10_15_x86_64.whl (30.6 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

caio-0.9.10-cp38-cp38-macosx_10_15_x86_64.whl (30.6 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

caio-0.9.10-cp37-cp37m-macosx_10_15_x86_64.whl (30.5 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: caio-0.9.10.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for caio-0.9.10.tar.gz
Algorithm Hash digest
SHA256 522e76597946df8b8fdff05412ca5096859c4d090df77a612f772f615892a0b5
MD5 d97d16b79a2ac62cd4910fe77adb196c
BLAKE2b-256 45bf7cc56f38528f1a9721f09e831836616c74d95854f8f553d67ac310b2cb59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.10-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for caio-0.9.10-py3-none-any.whl
Algorithm Hash digest
SHA256 01e1d94eef544785a5c11d187341f0332be56e5311494cd66870018b1f1f1285
MD5 70859021066dfea8df8f6732fd489037
BLAKE2b-256 ec4a90616230c927a6dbac4636afca7432d1c5195252a4dbd7cb9c6fb2504750

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.10-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ecfac86f1848cee0dce1ed11891cc91e344c7e7941007a788779f15f8c3276e7
MD5 e0b19ea0988b52733cb8a543ba0604fe
BLAKE2b-256 7e9a516a9fc940808416c60c438dcc09c67ad06ee903e3e7bfaf3953bd3ad399

See more details on using hashes here.

File details

Details for the file caio-0.9.10-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.10-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 25b4cb128b1c34d44794b3db7a8ca00f6fbad4a1e5e4682b4ca3dd61c28941ee
MD5 682f9eccd8f53e0d9d006c6334795a3a
BLAKE2b-256 82f39ce0fa269ee34d6cc921afd2772579935bf751534da12fe4eee9de868d6d

See more details on using hashes here.

File details

Details for the file caio-0.9.10-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.10-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 95c5a80a0cb1558a7b0b9d9a35ccc30db1ef9d898615a6fd220f1602badaa8d3
MD5 9c034e805a75aaf5425e6cdfd91f1eec
BLAKE2b-256 ca7d83e8b8d984a8a13c3e0b95a7ddb44d4ddfddf2cc1b491292c6b24b99b696

See more details on using hashes here.

File details

Details for the file caio-0.9.10-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.10-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 36fa567c7af8e1052eab105666fc8ee29945868a115f1b196c2619bbd665e99b
MD5 6102c148ecdc5e77ec1ea90b377a9abe
BLAKE2b-256 a13e8d58abe3c10137bb735bc29d5fc17b0bd3743a0c750b1dd06da1e734bfe1

See more details on using hashes here.

File details

Details for the file caio-0.9.10-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.10-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ce8aa0dabe9fac8baeaae56fb3880fe109634da1dc6b71dc45b57a3c4a7c74c4
MD5 9a1d78b0e2eb564c5e07c7bb3c971b24
BLAKE2b-256 e904401ed5f3787620360f8449e159e68cab6b038228ddf6025153324e7596bc

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