Skip to main content

Asynchronous file IO for Linux Posix and 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.8.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distributions

caio-0.8.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (82.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

caio-0.8.1-cp39-cp39-macosx_10_9_x86_64.whl (33.4 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

caio-0.8.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (108.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

caio-0.8.1-cp38-cp38-macosx_10_9_x86_64.whl (43.3 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

caio-0.8.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (83.0 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

caio-0.8.1-cp37-cp37m-macosx_10_9_x86_64.whl (33.3 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

caio-0.8.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (81.3 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

caio-0.8.1-cp36-cp36m-macosx_10_9_x86_64.whl (33.3 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: caio-0.8.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for caio-0.8.1.tar.gz
Algorithm Hash digest
SHA256 05741338a0fd7e4bf3d20e969a0e4a5687bc60fa81cbebe6230034650520a6e2
MD5 3fd2be24be793d521017e2bddbe9aada
BLAKE2b-256 779d9052020bd0996b4bcd41f575fa8c004f44fd0049554cb3aebd637ade669a

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.8.1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 408d55efab6fb5b391e9f5e4b34ad115ab30fbac0089bd116f83d77819ee8623
MD5 ed55f27e2099d96e3175a2022bb84bba
BLAKE2b-256 28d259bb4f5ede50439392f8fe7c339af3295d3e0ecefd3be76b372f0b7ca14a

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: caio-0.8.1-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for caio-0.8.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bba1356cb1e5e5d33654691999b41f572e7bd573da4065d4c8053df482d0e1b2
MD5 2568ad88da4a8bb2dd9b323bd56716ef
BLAKE2b-256 04e49174102f920b33bf65056c6d305f61ee461a1fd2792d288edb6a84065faf

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.8.1-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 99c92f4bb16b7aebf80051f7e76ada3b954c287f4900eedf0cb23ef2590f7311
MD5 cdce8cd510a7d43de193eec3c424ed1f
BLAKE2b-256 0c62648378e6bd96498477cc41839eda7a019726f92a6382819e496bab36d9e3

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: caio-0.8.1-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for caio-0.8.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 02bf84aaa2dee52486019d97c51e63b43bb4608d4a0f2b1d59cd15e1fc6a8afd
MD5 1b424aff39f513337306791af09b4464
BLAKE2b-256 7bdbbd7fc9ccad3ee916547010ab0474d0048d900e1ff7ffe4dc7d34a53388ec

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.8.1-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ee6680ea68f0210735102ce3ab958af79286d50dfd2d84cb10a475e9a70990e7
MD5 6a883e9cc2924936b2c4428eb9cc68f5
BLAKE2b-256 e952a0762b476f78ce9cc5cc424580e628b791e9d904e2af6d649f9bdd481498

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: caio-0.8.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for caio-0.8.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea06e3e9baff13cdfecb403b266f20693a51a9a0d7c27b33f2217d394d7be2e1
MD5 77b5d75fc1fbac926b67397a7d5b441b
BLAKE2b-256 ed124ec5e39f796951c02a0ab05563dab614214e117e7d9b9803b3e26a55ff4f

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.8.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c1be93c132761af1925410046048586fc970d3fc5ebd81346cef6465d6146ad5
MD5 d68517d043d8aa9c48b224c5d1fd2c11
BLAKE2b-256 25a3903836c7eda71ae98fdb37d61fa73a0950c3621290613266d949fb92097e

See more details on using hashes here.

File details

Details for the file caio-0.8.1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: caio-0.8.1-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for caio-0.8.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7e5f4b87628958b9eb0085f1d901a50acb4df6d6fedafea5958264142abe17d1
MD5 8098368d55fd221e6a615b149c09786a
BLAKE2b-256 46e2ca5d37f92b1ee6a658176279b8e44dc928dcbd990bc6ee0f69df787c3e33

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