Skip to main content

aiofiles-x
High-Performance Async File I/O for Python
Homepage • Documentation • News

aiofiles-x

Python 3.10+ C++23 License: AGPL v3

Elegant, modern and high-performance async file I/O library for Python

import asyncio
import aiofiles

async def main():
    async with aiofiles.open('file.txt', 'w') as f:
        await f.write('Hello from aiofiles-x!')

    async with aiofiles.open('file.txt', 'r') as f:
        content = await f.read()
        print(content)

asyncio.run(main())

aiofiles-x is a modern, elegant and high-performance async file I/O library for Python. It is a C++23 reimplementation of aiofiles with 100% API compatibility, providing up to 3.79× faster small file reads, 3.41× faster concurrent operations, and 2.08× faster medium file operations (100KB) while maintaining the same simple and intuitive interface.

⚠️ Note: Performance results may vary depending on hardware specifications, operating system, and workload patterns.

Key Features

  • Ready: Install aiofiles-x with pip and start building your applications right away.
  • Easy: Simple and intuitive API that's fully compatible with the original aiofiles.
  • Elegant: Clean async/await syntax that integrates seamlessly with asyncio.
  • Fast: Powered by C++23 backend for maximum performance and efficiency.
  • Type-hinted: Fully type-annotated for excellent editor support and type checking.
  • Async: Fully asynchronous file operations without blocking the event loop.
  • Compatible: 100% API compatible with aiofiles - drop-in replacement ready.

Installing

Stable version

pip install aiofiles-x

From GitHub release

pip install https://github.com/ohmyarthur/aiofiles-x/releases/download/v1.0.4/aiofiles_x-1.0.4.tar.gz

API Reference

Core Operations

import aiofiles

# File operations
async with aiofiles.open('file.txt', 'r') as f:
    data = await f.read()
    await f.write(data)
    await f.seek(0)
    line = await f.readline()
    async for line in f:
        process(line)

# Temp files
async with aiofiles.tempfile.NamedTemporaryFile('w+') as tmp:
    await tmp.write('temp data')

# OS operations
await aiofiles.os.remove('file.txt')
await aiofiles.os.mkdir('directory')
files = await aiofiles.os.listdir('.')

Supported Methods

  • read(), readall(), read1(), readinto(), readline(), readlines()
  • write(), writelines()
  • seek(), tell(), truncate(), flush()
  • close(), isatty(), seekable(), writable()
  • All aiofiles.os and aiofiles.tempfile operations

Build from Source

git clone https://github.com/ohmyarthur/aiofiles-x.git
cd aiofiles-x
pip install .

Requirements: Python 3.10+, C++23 compiler (GCC 12+, Clang 15+), CMake 3.20+

Manual Development

# Install dev dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest tests/unit -v

# Run benchmarks
pytest tests/benchmarks/benchmark_performance.py --benchmark-only

# Code quality checks
make lint          # Check code style
make format        # Auto-format code
make pre-commit-run  # Run all checks

Pre-commit Hooks

This project uses pre-commit for code quality:

  • Python: black, ruff, mypy
  • C++: clang-format
  • Security: bandit, detect-secrets
  • Commits: Conventional commit format
  • Docs: markdownlint
# Install hooks
pre-commit install

# Run manually
pre-commit run --all-files

Resources

  • Check out the documentation to learn more about aiofiles-x, get started right away and discover more in-depth material for building your applications.
  • Visit the changelog and stay tuned for news, updates and announcements.

License

License

aiofiles-x is licensed under GNU Affero General Public License v3 or later.

Inspired by: aiofiles (Apache 2.0)

Release files for aiofiles-x 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiofiles-x 1.0.4
File Size Uploaded
aiofiles_x-1.0.4.tar.gz 40.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for aiofiles-x 1.0.4
File
aiofiles_x-1.0.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
aiofiles_x-1.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
aiofiles_x-1.0.4-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
aiofiles_x-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details
aiofiles_x-1.0.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
aiofiles_x-1.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
aiofiles_x-1.0.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
aiofiles_x-1.0.4-cp311-cp311-macosx_10_13_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.13+ x86-64 Details
aiofiles_x-1.0.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
aiofiles_x-1.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
aiofiles_x-1.0.4-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
aiofiles_x-1.0.4-cp310-cp310-macosx_10_13_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.13+ x86-64 Details

Total release size: 1.7 MB

Release files / aiofiles_x-1.0.4.tar.gz

Download URL aiofiles_x-1.0.4.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dbd9b90ad75808c743cb474e482e2870cf6829047cd3aa3818323fb919b7002d
BLAKE2b-256 checksum
How to use checksums
cf1d714711dba41bd51c76d4994faf4014ad7fd9deac14a247042e1fd1a3939f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp312-cp312-win_amd64.whl

Download URL aiofiles_x-1.0.4-cp312-cp312-win_amd64.whl
Size 101.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
cd68a1d89aab47dc343de7b0a75127a83146b3c1085b3b7f407f0e7ea609cad7
BLAKE2b-256 checksum
How to use checksums
0c580bd51b0c7b1b61f1561ac55d85f03d859c5560724104e9d05d67c3f9fbf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL aiofiles_x-1.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 168.7 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8bfc3f5366396af437ba158170d7c09962501856ce828595c0cb3376aa30c889
BLAKE2b-256 checksum
How to use checksums
677ca87dd6dc091765111acca32a1001a2de961545f34987c91475d7b41a75d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp312-cp312-macosx_11_0_arm64.whl

Download URL aiofiles_x-1.0.4-cp312-cp312-macosx_11_0_arm64.whl
Size 149.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d20778d09a796a0f5de7e9b9bd3f1dd9f63fa2845d08c379087bbde12b4a59eb
BLAKE2b-256 checksum
How to use checksums
903c97b7481006da0e3b9125bc2a2ac47581a2076da4a19ad90eef9ec258f3e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl

Download URL aiofiles_x-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl
Size 146.5 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
b2f2084b648a2a0ff3d41d171de4bfa5176db82fd0366e6260f3a6e01e8635b3
BLAKE2b-256 checksum
How to use checksums
e78336af22abf68f7789c74272effd1eb01d44a5efe5ff06622b86d30c6cf26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp311-cp311-win_amd64.whl

Download URL aiofiles_x-1.0.4-cp311-cp311-win_amd64.whl
Size 102.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8f0e70ca7a0f22c3aca48a96abdc66cbd0dbe273918b373a578c067c75e4487d
BLAKE2b-256 checksum
How to use checksums
ec96b02d289fbaa4774eed793a00817288ba1271cf8d41971e06d43162dda1c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL aiofiles_x-1.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 169.0 kB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5bb2bd89c7b49a92a129782b880526455eb232fb8853a7384758ac09d71e80be
BLAKE2b-256 checksum
How to use checksums
677576054a3a0756f3fa21ab38aa36deaf052a61f4cd4d4f966b2d361ea798ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL aiofiles_x-1.0.4-cp311-cp311-macosx_11_0_arm64.whl
Size 150.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7634e26e58a90e367e10000ae441dfe80af916e0190a365fded576ed762a7b67
BLAKE2b-256 checksum
How to use checksums
bbd15d506522c65176fb73f946d606614b409a4bbef46b9888126288cffb069e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp311-cp311-macosx_10_13_x86_64.whl

Download URL aiofiles_x-1.0.4-cp311-cp311-macosx_10_13_x86_64.whl
Size 147.6 kB
Tags CPython 3.11 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
8afda2f0a1b9b39624e54af3ef7e465ff26b74956ac138945874708eb7e2b469
BLAKE2b-256 checksum
How to use checksums
73934978621dd6043c40ebf8af8f17cf6b75f8a12575fbd59820f931805336cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp310-cp310-win_amd64.whl

Download URL aiofiles_x-1.0.4-cp310-cp310-win_amd64.whl
Size 101.2 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
59034a18b5bee803d4ffea7b1562a3936e2f0f2ebaf4bab7f91f14f7a2657f07
BLAKE2b-256 checksum
How to use checksums
60929174a76c2efc96c36db5c43cbd7f24dc740c86a65f1acb52138ab32234f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL aiofiles_x-1.0.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 168.2 kB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
da0b8882923e1aed37dc015b16337033eddf1fde3d250c2dcb7b7910931c7167
BLAKE2b-256 checksum
How to use checksums
40349c033aea369436fb805afd00b48ac34f143c05905fbf169197c749a82627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp310-cp310-macosx_11_0_arm64.whl

Download URL aiofiles_x-1.0.4-cp310-cp310-macosx_11_0_arm64.whl
Size 149.9 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a12303678f6460e553a2fee5bb763e419e7ad9ca539e4d6950218967ad8c3112
BLAKE2b-256 checksum
How to use checksums
b2d69c195068f413137ca44a1e5140bb954ebaa2e421dbc447af814b789a482e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / aiofiles_x-1.0.4-cp310-cp310-macosx_10_13_x86_64.whl

Download URL aiofiles_x-1.0.4-cp310-cp310-macosx_10_13_x86_64.whl
Size 146.7 kB
Tags CPython 3.10 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
5b3a08d6d12a7fa916b88a8ac4632b379d98245f0c29da96624f9b45ba9e3319
BLAKE2b-256 checksum
How to use checksums
0ab961b2ffb660c1a1af646051fd1f0f3ec547f3667847b4280e24ae40f5b1e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.4 This release

13 release files

1.0.2

13 release files

1.0.0

13 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page