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

Uploaded Source

Built Distributions

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

Uploaded Python 3

caio-0.9.15-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.15-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.15-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.15-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.15-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.15-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.15-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.15-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.15-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.15.tar.gz.

File metadata

  • Download URL: caio-0.9.15.tar.gz
  • Upload date:
  • Size: 24.9 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.15.tar.gz
Algorithm Hash digest
SHA256 55ad8e5df4851acac2087c47bbc06b27eeca05ca7950ca024cbc56346b33a887
MD5 626771e41bae1c96bd6bcae37a7f360e
BLAKE2b-256 ffcc210f5ff0d22d4c6e3b10ea597bab474e120371153ef6526a14a08e1023eb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for caio-0.9.15-py3-none-any.whl
Algorithm Hash digest
SHA256 59a746e82018143e15ae971bd4239416bc292e230289c90e82e6b3e49fdd2ddc
MD5 36600ccd87203c13544220dbdf43e9d3
BLAKE2b-256 bf2e9dc70b8079b7ca40045ce74b4196d8d4cd701e9377002c76fa8bc602574d

See more details on using hashes here.

File details

Details for the file caio-0.9.15-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.15-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 daf775f6495ada45da955c05d7917215d582146d5445e56d9e58b7019a6eb4fe
MD5 5ae17cdd91772e389a94be7f98184b53
BLAKE2b-256 a5707bc69eeaaa30157c3f0fb64fb37c7be8f7304266307405f4e7725b4023ea

See more details on using hashes here.

File details

Details for the file caio-0.9.15-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.15-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90976f40a13b706475647583feb5518e2191b3ef153ec926eb3a1ae71c438c50
MD5 e573149c5e7a6d28caaaf00cdd69e75c
BLAKE2b-256 d2829cdd3b4028a72ba75f5279004ca11604aee1caa8624ca60fbe1afe710ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.15-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 75e6731114f11144497a3991769f249e9d5e48a66475131f837090de4288c745
MD5 996a1a6f7f954d711aa76d5bc2642ef9
BLAKE2b-256 e8e8b2d477e94cef00eac067d2a6541213bc0068dfc0e2951ed518e3ad745ccf

See more details on using hashes here.

File details

Details for the file caio-0.9.15-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.15-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7892ba091d93f379270dddc03d901c7fd6af93c89751b31fcd5e2e2148e0d3cc
MD5 c83932c72e0c0abaad87d9cb65e68025
BLAKE2b-256 b1f93ee84e9961add526480d2efbc32845b2ce4cf4c456ad25f457e859793bd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.15-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 73d694f1eedea7679489c1a9db0dcc0479450ddb0cec2e5c652bdeddc90e9443
MD5 5ef5d39a2d16329481ef7b232eba2c51
BLAKE2b-256 14ee8c5c820145bbd2e3dd907541393e5d0f1088698087179bb76c91e2a6435c

See more details on using hashes here.

File details

Details for the file caio-0.9.15-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.15-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9595e0ae06e77aea51d294755c6bcae73dfd68a4e133f72d285f9f5b5f10a760
MD5 dfe4c581a7d866aa99d22d7b37710494
BLAKE2b-256 110868c7e571044516a28eea70fcd9ffa0e86e115d95012158f5bfaad924fa7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.15-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ab01ec5c7f6389372aa18a378c43d4546d2db4f6008d643bddfa0ff66175c6bd
MD5 d5649965bfa59bf53b5b7f4046c99b2f
BLAKE2b-256 8421ee32026ff8a984b53b24fefef06bdb969354a400955c9521659c2f790141

See more details on using hashes here.

File details

Details for the file caio-0.9.15-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.15-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aabb70f0a44c89ae743b873b58b546bca2677672802c2ac66b77a4f6cec795aa
MD5 523a37789bba203f6c05c6a21a8ef5bc
BLAKE2b-256 abaa29727fdbddf3a5952e2a25feb10d1885089ece5459f7418810d7d917ba89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.15-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 86420193f12c050e7ac9fdf7c432bed7219de089310cf3a473d552b8a4f98471
MD5 56e6d1a7a84fc24ca0f7870b845894ee
BLAKE2b-256 823817c2303960e56d1f33d27cbd04b729b223c87c20bc214967d732a591c7ee

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