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

Uploaded Source

Built Distributions

caio-0.8.3-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

caio-0.8.3-cp39-cp39-macosx_10_14_x86_64.whl (27.3 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

caio-0.8.3-cp38-cp38-macosx_10_14_x86_64.whl (27.4 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

caio-0.8.3-cp37-cp37m-macosx_10_14_x86_64.whl (27.3 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

caio-0.8.3-cp36-cp36m-macosx_10_14_x86_64.whl (27.3 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: caio-0.8.3.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for caio-0.8.3.tar.gz
Algorithm Hash digest
SHA256 ebadd6748fb35909dd8431076994e5760186c4d0c5edb114927a08376492949f
MD5 5247e8787f72924ccb7acbc25736fc11
BLAKE2b-256 34bef9759d5061da3dba97c253603b6572b87595e4930de8535630d265d7092a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for caio-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a8063f1f78fd909247b32a1ea183e61a40af0b9304629949707f71dbeb3fb7bb
MD5 9416ffb84395406fdc9ac121b1fb9773
BLAKE2b-256 f475884c85d739530701b3fb4dbdf45f5fd830709322b5486ca9cf2a5f0d55e6

See more details on using hashes here.

File details

Details for the file caio-0.8.3-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: caio-0.8.3-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for caio-0.8.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 829c195d28e869da9a084e2b8c78d1e6c2bf2f43710ec3f9533bdc56455e9257
MD5 2bc041c08dacb5c8be144909bda49961
BLAKE2b-256 ae9067e0d65504a779cbbea9b95919031df543529120e3d0dbc871b6b590e6d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.8.3-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for caio-0.8.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 6a7d42733b34d1d8a5aaa35bcf5efce3f8417013f44d95e9f77c1c601fc6c4c1
MD5 d67f1ea4123db73e0670152a37a46e97
BLAKE2b-256 f3fe788f4fae4564a8a62cbf0d21e7054a3addccce57374cc332d4ab35ffe2fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.8.3-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10

File hashes

Hashes for caio-0.8.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 647a4102d9b0869ff20b5413713666ea4c97e1f694e6db1c73e1ee2cfa57ebd8
MD5 11eb23934df67f53df8689a7d9a37820
BLAKE2b-256 d6a457cc8bb7f9dc4c3b9e161b9795741cfdc3b51c958728a9b2ca438642eee6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.8.3-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for caio-0.8.3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f74b68141dedee3e8520bfceae973ebedaee237b9405d3a98dbac7059f8588aa
MD5 e866d5da831a23189112f5a99f74f7ad
BLAKE2b-256 30658504b111c64c9468fa061a819e7a904c272f67f3b6bd1c291a579836fd12

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