Skip to content

drawing

aiopen⚓︎

Wheel Version py_versions Ruff

Install: pip install aiopen

Breaking change (v0.9.0): the aiopen module is no longer callable. Replace import aiopen; aiopen(...) with from aiopen import aiopen; aiopen(...).

Async-open

Why not use aiofiles?

  • Wanted more type annotations
  • aiofiles uses ye ole @coroutine decorator -- aiopen uses python3.6+ async/await

(Big shouts out to the aiofiles people, aiopen is entirely based off of aiofiles)

Usage⚓︎

Just import it!

from aiopen import aiopen

async with aiopen("afile.txt", "w") as f:
    await f.write("some text!")

async with aiopen("afile.txt", "r") as f:
    content = await f.read()
    print(content)