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

Uploaded Source

Built Distributions

caio-0.9.4-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

caio-0.9.4-cp310-cp310-macosx_10_15_x86_64.whl (30.0 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

caio-0.9.4-cp39-cp39-macosx_10_15_x86_64.whl (30.0 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

caio-0.9.4-cp38-cp38-macosx_10_14_x86_64.whl (29.8 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

caio-0.9.4-cp37-cp37m-macosx_10_14_x86_64.whl (29.8 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

caio-0.9.4-cp36-cp36m-macosx_10_14_x86_64.whl (29.8 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: caio-0.9.4.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for caio-0.9.4.tar.gz
Algorithm Hash digest
SHA256 fbae5f1bd8afe70da6501eb04ef3150984a228861cefa358ae7123a1c8b61ad1
MD5 62d0bfa6c5223218e8d5436fc6166fdb
BLAKE2b-256 aad5d1cada006b86b340040e0aece2473d8b55482718b73e8316c96e81317e4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for caio-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 45eb62720dfbdab4e0182f265395746b94295aebe567d3814d76d731b879a92c
MD5 d2528567b3bcca66c299ad5798c0150d
BLAKE2b-256 2cc5a4fef689d1e13484937d532ab0a85477fdbd490fe73cdc0bf890319f01b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.4-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: CPython 3.10, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for caio-0.9.4-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7c49b8009a2050acb4f71187f8d740d2935e99da20dcdc7295b558d7c81d61ff
MD5 e60509e377f627cba2fb6296b346874a
BLAKE2b-256 c5478d713bdde06598ef3c33018a3906c9b44fbae6c60ec8668555481646df12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.4-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: CPython 3.9, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for caio-0.9.4-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0ef629ddaa9d3d6c248b4b9d7a3c9ea083582b389a65165789396398640b5ea6
MD5 3d33f8c7ff416c9b44a1c315b6ad3281
BLAKE2b-256 e10f49cdf620e891b39a9cffb23a91de84e6cdca03ff10c016b474409ab0b7a7

See more details on using hashes here.

File details

Details for the file caio-0.9.4-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: caio-0.9.4-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for caio-0.9.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 aa3403bed38e322f0794aa363442b4a1538f3a7cfb93e97f464b263ac7b97a47
MD5 e3ec643683cf0e752198e195a09d83ec
BLAKE2b-256 e3a4a6dd99deb235ce2c84a57422bb28200dcf462964d7cdda0026e7b39adf0c

See more details on using hashes here.

File details

Details for the file caio-0.9.4-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: caio-0.9.4-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for caio-0.9.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 87f05a4d47dba1afa8abe1fa57d7e7b9e2d427a7699d52523e70045791c74ae2
MD5 0eca366d9a4fb14c1745d26d828c4d24
BLAKE2b-256 e5e57e462c98218f67e99c0c36f84746d328c0a2201721e1bdb716a2e8201335

See more details on using hashes here.

File details

Details for the file caio-0.9.4-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: caio-0.9.4-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for caio-0.9.4-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e7371e484778872bba3ce6a8bd9707c627971494935bc966ca67c89b6123a056
MD5 6ada98446c97f4e7d7a4d3365852cb05
BLAKE2b-256 c2e6c5dca1f81a3e39ee7bd528bd9e8ae5860b7d8ba934f15ab0de0d42292056

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