Asynchronous file IO for Linux MacOS or Windows.
Project description
Python wrapper for AIO
NOTE: Native Linux aio implementation supports since 4.18 kernel version.
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.
- In runtime use the environment variable
CAIO_IMPL
with possible values:linux
- use native linux kernels aio mechanismthread
- use thread based implementation written in Cpython
- use pure python implementation
- 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 oflinux
thread
orpython
.
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
caio-0.9.17.tar.gz
(25.0 kB
view hashes)
Built Distributions
caio-0.9.17-py3-none-any.whl
(19.1 kB
view hashes)
Close
Hashes for caio-0.9.17-cp312-cp312-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e320b0ea371c810359934f8e8fe81777c493cc5fb4d41de44277cbe7336e74 |
|
MD5 | b261932ac06547fb277d5e5d098776b6 |
|
BLAKE2b-256 | 80f55e993120daeb4ec084f5f84c118bbd48b65379f63ed56919bf224e0eab42 |
Close
Hashes for caio-0.9.17-cp312-cp312-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ddb253b145a53ecca76381677ce465bc5efeaecb6aaf493fac43ae79659f0fb |
|
MD5 | 5430673ece8e7b01e576de25196dd465 |
|
BLAKE2b-256 | c3b837dcee4bc4fae1701a86373a297bbca797f6b7bfe5f85993a11049649c63 |
Close
Hashes for caio-0.9.17-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 549caa51b475877fe32856a26fe937366ae7a1c23a9727005b441db9abb12bcc |
|
MD5 | 4fa7c59e2f105d1721b9a90811a79392 |
|
BLAKE2b-256 | 57e21d04e506a5fd735856f0bb95b4d03b800947bd43c98193ee57d37070a51e |
Close
Hashes for caio-0.9.17-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 079730a353bbde03796fab681e969472eace09ffbe5000e584868a7fe389ba6f |
|
MD5 | 71a9e993f967446156ae1f710538e24c |
|
BLAKE2b-256 | 5244a79c7004a9562a176d78437816c736c34ab9fb6233a4b8164eb25628a09c |
Close
Hashes for caio-0.9.17-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3028b746e9ec7f6d6ebb386a7fd8caf0eebed5d6e6b4f18c8ef25861934b1673 |
|
MD5 | 4c2a2c0d84885f0819a99037b05a34fb |
|
BLAKE2b-256 | bf3f0ae9f69deb3dc96b20bf084cc262b438a154d5de08a064628272713ff239 |
Close
Hashes for caio-0.9.17-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f69395fdd45c115b2ef59732e3c8664722a2b51de2d6eedb3d354b2f5f3be3c |
|
MD5 | d46eeb9393f7caa2c57f8b571cb437fe |
|
BLAKE2b-256 | dbc317bc41b7c795d91d58ee7a70ad98e23f1ba0d50bdeadd82173bb02cddc8e |
Close
Hashes for caio-0.9.17-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40bd0afbd3491d1e407bcf74e3a9e9cc67a7f290ed29518325194184d63cc2b6 |
|
MD5 | 17b417745eebd09c7a7b7324ac475767 |
|
BLAKE2b-256 | 7715d9410b3538e9454380469b43a4750f176ff543c17bba524fd25e55bf2054 |
Close
Hashes for caio-0.9.17-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fca916240597005d2b734f1442fa3c3cfb612bf46e0978b5232e5492a371de38 |
|
MD5 | 68bb52a0fb29b4fd9a5502f8aa94a1db |
|
BLAKE2b-256 | 00a23bfb94f7edaa4361ce62692e1bbd70355693cd45d96342eecf152862f6ae |
Close
Hashes for caio-0.9.17-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3e96925b9f15f43e6ef1d42a83edfd937eb11a984cb6ef7c10527e963595497 |
|
MD5 | 3fb7bf53cff1879bb45643060087ceac |
|
BLAKE2b-256 | 44eb313a36e1faa015a6ab76393b48f1f9bd56d9eaf79f650b5ddfad884d81f7 |
Close
Hashes for caio-0.9.17-cp38-cp38-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a39a49e279f82aa022f0786339d45d9550b5aa3e46eec7d08e0f351c503df0a5 |
|
MD5 | 7e84db9fc73407fbd369474b619b7f03 |
|
BLAKE2b-256 | 7580c54fb589cc6e00085656d9ff93d6a0e36f403648dbb38a300f237ba875ae |