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

Uploaded Source

Built Distributions

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

Uploaded Python 3

caio-0.9.8-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.8-cp310-cp310-macosx_10_15_x86_64.whl (30.0 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

caio-0.9.8-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.8-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.8-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.8-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.8-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.8-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.8.tar.gz.

File metadata

  • Download URL: caio-0.9.8.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.8.tar.gz
Algorithm Hash digest
SHA256 70c9556dc003df1e3ea8dca5cc32ef0bb9213cfbc5a2b80003ba37018689326f
MD5 42f1ea424270b733592045f81f0962d8
BLAKE2b-256 ab051173ac976314ecb0a0437174c766f91cefa49ea1ecdec653b41506e06fc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caio-0.9.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c3704fba1781c252d5dcfce4e81dc5af2d50a61062f00fc74dd252a419af8918
MD5 136baf884be88bb04c1793e85f130d0e
BLAKE2b-256 bfd5965fd0b49895dee2cf7a595891eed505ac05dbb9cc42f3647b59bba20679

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 38a30e7e0184b45a54fbc757ac3e1a2b8eb9c41f362d2f4bf5854d50bff73c6d
MD5 20bccce2ebbd0302c1452d587eb42770
BLAKE2b-256 c2c7851a4bf6711805dee4287c430a6c14299f639391ca86696626d8e1569b0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 e9969edea88caf2d38059fe7164d1271f8ba6d94d39e890a9bdbabca483a9a19
MD5 de2935a82f6061126f13916a8e70f4dd
BLAKE2b-256 c9df85eea4ed7b2d88ed1dd1609aeb7728e318c4422420865fd58613f6e95283

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0ab003c48679d00b83992d68012c1126e4b91d6c27d16f363d0e5c9a499898e9
MD5 bd4f3a48a4209c62646c0bfd4ee78d88
BLAKE2b-256 25a53306689906abf60fa7bafbb271a82dbdf5d22868bdd36c93ccdfc23c1aa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f748b0605b9b95bfa58c81a5373555d4c82228f9b3dfd608de706a906fe703f9
MD5 a60c4e6d63fd95f975b784195da63e8c
BLAKE2b-256 3790d393a8459361c801f93e54652c9cd2121bc3261e720cf6a611580b457108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 65395113a506efb605d90c75438686718c1d4784bc029e04d235adcf5d5d3a39
MD5 ae24e155f9ac8f6d17c16b28b76b8e60
BLAKE2b-256 67b276f7cf9f53199d3d361e715e279b3eec8f026a37a01be66d7d1dd581db7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d29709f5ff9582d00ebed37327f14e247eedf33e18d4b35a6af6ab30cc8df9b7
MD5 89bbd775db902996c1d387ddb87b42b3
BLAKE2b-256 1794f48a5b2a8d26d377962f3ec25c473af1e09435e31cc2467da0d54bd929d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2316252dbb16195b0292a5dd665901966c080001d0ceed8540f98c073b921b0c
MD5 eae46659a48bf8a596430e90251ecdeb
BLAKE2b-256 2a7c75016f45ac3c38b4c71340aabd8b9f16241d1a554a4208d0888ae93b84eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for caio-0.9.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7275e5ca3a4960d40ca509ed19d7d23ea0156dbb4ac5834cf08724c989f8be24
MD5 75bac4d3e87cffa811868abad4ae4f60
BLAKE2b-256 e073d5946977d3e0f5286a03fe90ecafc7f47eac4a49735f7023f1f83555cdce

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