Warning
The library is in the pre-alpha stage. Bugs may exist!
- 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.
The library is available as aiostdlib on PyPI:
pip install aiostdlibFor 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)For more, see the documentation.
import sys
from aiostdlib import os
async def main() -> None:
fd = sys.stdout.fileno()
detail = b"Hello, aiostdlib!"
await os.write(fd, detail)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")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)- If
AIOSTDLIB_CONCURRENT_WORKERSis 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 of32andos.cpu_count() + 4is the limit.
MIT License, Copyright (c) 2025 Sergei Y. Bogdanov. See LICENSE file.