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

Uploaded Source

Built Distributions

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

Uploaded Python 3

caio-0.9.14-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.14-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.14-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.14-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.14-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.14-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.14-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.14-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.14-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.14.tar.gz.

File metadata

  • Download URL: caio-0.9.14.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.14.tar.gz
Algorithm Hash digest
SHA256 71f93f29885d7c2d5e87235c6792afb33492d7a42700ce2d2b578135ea7496a6
MD5 e35f536a4230602fad0759daee4a05b3
BLAKE2b-256 74afa3657cad61193da1b64a146ca1a3c4a13f65de5d34a6b188cb236929a5fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.14-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.11.9

File hashes

Hashes for caio-0.9.14-py3-none-any.whl
Algorithm Hash digest
SHA256 71ab8afb3aa4d0d910a44555f29c463bd41dbfb07b4a35f97efe62d3433c7ace
MD5 5a123872c46781a2e0dd175bb24f70e9
BLAKE2b-256 e9d21eac4aa5de26597c62b7c75ca67918f64a33e692477f627c4f4d4f04c698

See more details on using hashes here.

File details

Details for the file caio-0.9.14-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.14-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b139d10934e652a504d152d4f88bbb901c89e1984cdd7d8ccc9286c1c2defcfa
MD5 38f92a3405b679c4c55bad728c282841
BLAKE2b-256 071f5b7256b4cd20d5ad355bf50917f9fd84a3d5acb6ccdf3e64946033b8c053

See more details on using hashes here.

File details

Details for the file caio-0.9.14-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.14-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b767e858248bc4bcd307055a00591b94fb1be79c7e4f9a61832b733fcfe1840
MD5 bf6b625eff498d4cf6a9cd59f02d76db
BLAKE2b-256 6238dac2e42a8b4c1bdd7ca4c5fad044018e3b8b918005239f5adad625d1b3f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.14-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 499fc77fd6844d18d8b600b6a1e1dbd578d5a50e0ccc38e3d53de04cd3dcbc2c
MD5 c905e28d32b5f454bf330a2a386728ce
BLAKE2b-256 360ab21fa4b8f15d603a89b19100da14233a723ab92d4d26bc43dc6078858c96

See more details on using hashes here.

File details

Details for the file caio-0.9.14-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.14-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4538f06c26f315ca9d00ac499105c3feb3125dc009e2e8568ce99476d4ece19b
MD5 ef0f884f567f5ba827ed2bd1b4977bc8
BLAKE2b-256 f9cc744c47760584e865ce6d7273fc4518847fb3a9a59d7c9709f27760033d3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.14-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 14b618bd8b8a1c64969b7c529ed7dead75b05d8c984032787dd60db576264c4f
MD5 fa28c53ebfca1e292ec70857f10f8cc2
BLAKE2b-256 7f6bc53bf2b81bb219c3f4795d1700e4466b4763e2606923d2bba8c4414a2975

See more details on using hashes here.

File details

Details for the file caio-0.9.14-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.14-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a99d993d9589f522f3e34e731e846f9f65f2071b26ba12e41d394a1a9ee8f467
MD5 353c9e835f2ba7c69975c37a13d88e88
BLAKE2b-256 a2b5c2dacde4f9c024b13d19c4ad91101baa3d3021e606ef7f2208964571c0e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.14-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9b85b579d759a742c4f99e182eb27c9ebd245d9ed4ae7139c9fb0cd41de6814c
MD5 c19103533c93cba8fe5cc44a92d9e73f
BLAKE2b-256 591c9784fe0517f2f3e6922dd4020e30b86430c4795f6930ca942e8bba54a303

See more details on using hashes here.

File details

Details for the file caio-0.9.14-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.14-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f224393082e38e11247e95d3b9617bd5110cfb41778bd0f00322fa6b73fd8fb7
MD5 49fc16e3c5c8bb051ef559ab0a457c7b
BLAKE2b-256 f8746cd6cecf5d7f72efec219f75f49b285419360cea7055244e91a5438e779c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.14-cp38-cp38-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 11b653365f94674f1d24197f615f4bc115203dfa75df15e8a5134133d0e66f00
MD5 ee3f4bdd276ad0d8159630d1d51904c0
BLAKE2b-256 fce235baecec11be77377db956444af849a2f52878e974a69373338d988dc5ff

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