aiostdlib

PyPI Version PyPI Downloads License Python Version

[!WARNING] The library is in the pre-alpha stage. Bugs may exist!

Key Features

  • Provides asynchronous version of the standard library;

  • The same API as the Python 3.13 standard blocking API;

  • Blocking IO is performed in a separate thread.

Getting Started

Installation

The library is available as aiostdlib on PyPI:

pip install aiostdlib

Usage

json

For more, see the documentation.

from aiostdlib import json

async def main() -> None:
    with open("aiostdlib.json", mode="w") as file:
       await json.dump({"pypi": "aiostdlib"}, file)

os

For more, see the documentation.

from aiostdlib import os

async def main() -> None:
    fd = sys.stdout.fileno()
    detail = b"Hello, aiostdlib!"
    await os.write(fd, detail)

os.path

For more, see the documentation.

from aiostdlib import os

async def main() -> None:
    if await os.path.exists("./aiostdlib.txt"):
        await os.unlink("./aiostdlib.txt")

tomllib

For more, see the documentation.

from aiostdlib import tomllib

async def main() -> None:
    with open("aiostdlib.toml", mode="rb") as file:
        data = await tomllib.load(file)

Documentation

Environment

  • If AIOSTDLIB_CONCURRENT_WORKERS is a positive integer, then no more than the specified number of threads will be used to execute calls asynchronously. If zero, then threading is not used at all. Otherwise, a minimum of 32 and os.cpu_count() + 4 is the limit.

License

MIT License, Copyright (c) 2025 Sergei Y. Bogdanov. See LICENSE file.