Asynchronous file IO for Linux Posix and 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:
Upgrade the kernel
Use compatible file system
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caio-0.8.2.tar.gz.
File metadata
- Download URL: caio-0.8.2.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4918c7e6382c13a52be7b481a52d1ffc8da0805d0c1396255cbc977c448e81b
|
|
| MD5 |
4953fbd22f9f045845bec132ff099088
|
|
| BLAKE2b-256 |
5b41167e6b8317ee39291419cd2f1cbc7622a293e27bbb092cfbc7d69b42b188
|
File details
Details for the file caio-0.8.2-py3-none-any.whl.
File metadata
- Download URL: caio-0.8.2-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fd8e4ab879e25a5503919d0545b62f17078f826fb950ef5ab73129822baa1cf
|
|
| MD5 |
0a31269531109c472831283540035e56
|
|
| BLAKE2b-256 |
1a4569428aa5688e65081b022e65ce9a213915ce6be8e834c63406914830a2a2
|
File details
Details for the file caio-0.8.2-cp39-cp39-macosx_10_14_x86_64.whl.
File metadata
- Download URL: caio-0.8.2-cp39-cp39-macosx_10_14_x86_64.whl
- Upload date:
- Size: 27.3 kB
- Tags: CPython 3.9, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac163d1bc5573681b2db0b9b59c789bac0c1442de82a8cb545f8681fe42fd154
|
|
| MD5 |
b5faefb4d448b6be190686155bcbdf4c
|
|
| BLAKE2b-256 |
d4cdcf0cdb9c65012d5cca98f07808e99b3e82fe15f5f57774224602e81f40ad
|
File details
Details for the file caio-0.8.2-cp38-cp38-macosx_10_14_x86_64.whl.
File metadata
- Download URL: caio-0.8.2-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 27.4 kB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aadc0f4ad2f5cbfd0772acd20409ba284d46039f00d71f704adf4ff8cb8354e3
|
|
| MD5 |
d32322f5e9afe0e63b73effc1baa5529
|
|
| BLAKE2b-256 |
c26e23ab6e57f67be789db781f524f8fff42bc800b93683124cb585157e6565d
|
File details
Details for the file caio-0.8.2-cp37-cp37m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: caio-0.8.2-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 27.3 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc070ae129e21f720414379a43db14bc3a46a5d3c578bad1cef94b4ceda56319
|
|
| MD5 |
a5810120e1707c49eb7a12ceab7264f4
|
|
| BLAKE2b-256 |
46729c0396a170d7355e5a4de2a78974df3ae8794036d1e2bdae18c8ea5f641b
|
File details
Details for the file caio-0.8.2-cp36-cp36m-macosx_10_14_x86_64.whl.
File metadata
- Download URL: caio-0.8.2-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 27.3 kB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5189ea23726948cb4b5d0a3a79db90824654ad07795fab51e75f973ba5c3f20f
|
|
| MD5 |
91e41edc15a54dc09c16f8f42ee5c45d
|
|
| BLAKE2b-256 |
b92e6536140a97f9900fbd186f465c3103df21e52ebbac0779466edf5c59504f
|