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

Uploaded Source

Built Distributions

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

Uploaded Python 3

caio-0.9.6-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.6-cp310-cp310-macosx_10_15_universal2.whl (37.7 kB view details)

Uploaded CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64)

caio-0.9.6-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.6-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.6-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.6-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.6-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.6-cp37-cp37m-macosx_10_15_x86_64.whl (29.9 kB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

caio-0.9.6-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (85.7 kB view details)

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

File details

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

File metadata

  • Download URL: caio-0.9.6.tar.gz
  • Upload date:
  • Size: 24.5 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.6.tar.gz
Algorithm Hash digest
SHA256 a0c2111ec0fe94f8ed873d36d33344b765cd047855408faa9513e549070d3cf4
MD5 388a3c6070f8411cbec0de902cffc67e
BLAKE2b-256 4e8c8dceef5f297aeea625863f6c4839085d8301188f0237db93e29a50cca976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3e78159be5ccd070a0d7bcb4f0d60bbe5dd4970aa928218f6899f6e112cc963e
MD5 3bae7270a1396d95194bfcb38c0d87c7
BLAKE2b-256 242be0eb8a1d04d81fb6fd498d1a8f1a6edf619320229c45642e66e552cc343a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c702e86c7f446d69353e335de6c11ae9291b4408a1a510b3a7150e67576b0943
MD5 deeae6e5c8ff60fd8acbc5963053c207
BLAKE2b-256 9cb0d606fd173ff14786f8846dba7c7a1270076edc37894b5a4d46897dfc3b34

See more details on using hashes here.

File details

Details for the file caio-0.9.6-cp310-cp310-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for caio-0.9.6-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 68507b23b2e0927a600e304ee455d5a4890ba7abcc8da9c169c1ff76667d73d4
MD5 920de84adf2afc204b5a29fd55efcaa3
BLAKE2b-256 6312ac029781139cfd08977842982de23d0b3f6f196be510f7aa1b0a116a8e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 395c56a052157453144e39f71e39120c48975b9b810779145c4c961c1f2776b5
MD5 5ddff02154084f408a28bea8aaa11e88
BLAKE2b-256 caaa46a9d418fcb8fddfa2b2eabcc3bb436500368da8fde26203ff0b69b91949

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 c10e9b8dca38b262b536b421c2036d55c382497d85ac57426df6c86934b4e479
MD5 fcadf75d4dfa27da12356970e6855e9d
BLAKE2b-256 5053a1c8177620605d6c90492a7e0edd6a4288a832949a513058d39834a3ff8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ea0e87d1206acd8954ac08eb24fef8b0e3475fd12f9b521325561bda723a324e
MD5 e5798b44d178dc923db6beffca3d574e
BLAKE2b-256 86698cec99629d3ae71adf02423c2456ce1c8eb60434748ea78ca7367016c936

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3c6f233dd3a6072c19738650fb11cfb0b02ed675fea4631ab8ae9e214fe2259d
MD5 248afeeb80fbbba27a3b44eb04c7088e
BLAKE2b-256 de377ecfdd22f17849c6267859d0e4cce46eb3ecae40cf22a65d6a29bd288416

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2d9f74792606c0210ac81cb08451bcd4fa8f5857cef01eec1c7fa748f4283cd5
MD5 a209fa1ca81f21ec311344cc30eaf230
BLAKE2b-256 3e2e63d3b3e68b5338d266dbc39f8d7718f7d53967d354d7a2c19b819e7585d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.6-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1e4adf1eb501f9b11c64bf92714c3b85f4f5fa7b804ddb48bd5cb5263b7bd168
MD5 5cd78c7c73b11271f7cc2876c1f28a95
BLAKE2b-256 3d5a86204c72e25327760e6eac5a8d65ff1ae43d3df0a1b38d406f2346583ea1

See more details on using hashes here.

File details

Details for the file caio-0.9.6-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for caio-0.9.6-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 fb499c23e03894a0f6d055d393087785b4b1578fe883f5da56d95ecf737365e6
MD5 88bf762378ab3fab27285d64fedc5d78
BLAKE2b-256 1bc67fea041ecc2857578be6b742161c351fac3b1652602d35afc03aa241b896

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