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

Uploaded Source

Built Distributions

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

Uploaded Python 3

caio-0.9.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (87.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

caio-0.9.7-cp310-cp310-macosx_10_15_x86_64.whl (29.9 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

caio-0.9.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (87.0 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

caio-0.9.7-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.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (87.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

caio-0.9.7-cp38-cp38-macosx_10_15_x86_64.whl (30.0 kB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

caio-0.9.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (87.4 kB view details)

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

caio-0.9.7-cp37-cp37m-macosx_10_15_x86_64.whl (29.9 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: caio-0.9.7.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for caio-0.9.7.tar.gz
Algorithm Hash digest
SHA256 0e8e7e7a00a7fa14a9bf1ecdd59b9c598e957386ee73574533a96532aad7b721
MD5 36e7060ba1cfd377353a8462d61e9bca
BLAKE2b-256 9e4966fe6f1c544ba84cd823dce649ac8436e765de4aff9fe12ca8f6947962b6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for caio-0.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0e03c98e3fc8266a335dee4e59f5cd819ea40438978cb03a71f4d9123d2e42ea
MD5 c601ea16c7353a1160e2bce8bae1d3f1
BLAKE2b-256 2787c2e85584a0316fe70b941976d5bc3c93386ba97a3eb91fe408d6e54f7624

See more details on using hashes here.

File details

Details for the file caio-0.9.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.7-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 463e0b795699de78ea853899574eb1e62670522f0792ff5a7f435771f40566a9
MD5 7365999978876cf8401c1df4e267675d
BLAKE2b-256 60394405eaec503d472725549935fa1db9bdb9a3264b5f140814c8ff1a187473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.7-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e34186b9e32a8f25bf27c1ec7fd8a23fa711f0fc3542bdb6e8d6074fd3afcebe
MD5 03aec62c0d8108125a6ef050ed3f06ee
BLAKE2b-256 0eb312a536fdfd0a12f38ff55ae03956ad9676c2bcfda12dcd09b1c4495110b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3d52c088f9948b976648bbd80725bc6f0c2fc6df2ed8e86a1e6795398b022525
MD5 b66eb1da0f1502f00191fb357f74d2ec
BLAKE2b-256 704b39b1a85144928a86431d4d5034d2db216c5fc537a751f403b7418324c39b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.7-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a7f3e1bde5fdcb3bdd9b1faa0dc9d7fec097901af0455f8df2af008a74fde033
MD5 9cf535d6370d60c4d246ea9d4867414a
BLAKE2b-256 168a0f07704b3c910d281efda67a98dd9cbc9d2fb66e7660c6323740b399256c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e72861f7f484d55acd52e169feba9efd7c3a82596a91e0c1ee34076492596e3d
MD5 5bfe15c5ca48df587c132ea7682120b5
BLAKE2b-256 ac9cf223870a410808498d7d1e9c6be15ddb44e2890c24e6569a8e04459bdff0

See more details on using hashes here.

File details

Details for the file caio-0.9.7-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.7-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7833a76d75a5f63c705df00b8d3af1fd55ce0fe369939d1d754c617956ad20ab
MD5 9dabfa239e7652258eff68cc23d9fab9
BLAKE2b-256 0a88059483e081506253dba9049f0c2e28616daf622413793c85a3c3a3d18975

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.7-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7508ddc6addd6c959577a66914d4de139bee0682316ebc63a1a5de9c91ca3176
MD5 2dea933e99559f8104cf82974ecbefab
BLAKE2b-256 12bafaae55a30c616748bb3949b20fc894cfd206b0734c25ca1630229891da77

See more details on using hashes here.

File details

Details for the file caio-0.9.7-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.7-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 a2b83f34a7902206c978b61340e412209fcf8b9cec8953c48ffda9b71cf247ea
MD5 527ce8c8c83841683e0d22a908ae98c0
BLAKE2b-256 630a61f726189b1b4674a00e120e2e8d3c426ba1239ca3901cb1c2f731addff2

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