Skip to main content

blazio

A drop-in asyncio event loop for CPython, backed by zio.ev — the completion-based event loop from zio (io_uring on Linux, kqueue and IOCP elsewhere). Like uvloop, but on zio.ev instead of libuv, and with real asynchronous file I/O.

import asyncio
import blazio

async def main():
    reader, writer = await asyncio.open_connection("example.com", 80)
    writer.write(b"GET / HTTP/1.0\r\nHost: example.com\r\n\r\n")
    await writer.drain()
    print(await reader.read())
    writer.close()

asyncio.run(main(), loop_factory=blazio.new_event_loop)

That loop_factory argument is the only change; the rest of your program is standard asyncio.

Async files

blazio.open() is an aiofiles-compatible API over zio.ev's file completions — real asynchronous file I/O, not a thread pool.

async with blazio.open("access.log") as f:
    async for line in f:
        ...

Seekable files also support positional pread/pwrite.

Performance

About 1.15x uvloop on transport-based HTTP. Measured on one Linux machine (io_uring, CPython 3.12, ReleaseFast): 20 s wrk runs after a 30 s settle, 100 connections. benchmarks/ reproduces them.

Both drive the Transport/Protocol layer, which is what real servers (uvicorn, aiohttp, asyncio streams) run on. The low-level loop.sock_* API is a separate path that the three loops optimize very differently, so it is not benchmarked here.

benchmarks/mini_http_server.py — a minimal Protocol writing a fixed 1 KB response, with no framework in the path, so this is close to raw loop overhead:

loop req/s p50 p90
asyncio 101,428 0.91ms 1.03ms
uvloop 127,036 0.74ms 0.81ms
blazio 144,781 0.64ms 0.88ms

benchmarks/uvicorn_server.py — the same response through uvicorn. Most of each request is now framework Python that every loop pays equally, so all three drop sharply while the ratio between them holds:

loop req/s p50 p90
asyncio 23,501 4.02ms 4.27ms
uvloop 41,596 2.29ms 2.35ms
blazio 48,274 1.74ms 2.53ms

Install

pip install git+https://github.com/lalinsky/blazio

Requires CPython 3.12 or newer and Zig 0.16 on PATH.

From a checkout, with the tests:

pip install .
python -m pytest tests/

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blazio-0.1.0.tar.gz (66.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blazio-0.1.0-cp314-cp314-win_amd64.whl (350.0 kB view details)

Uploaded CPython 3.14Windows x86-64

blazio-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

blazio-0.1.0-cp314-cp314-macosx_11_0_arm64.whl (240.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

blazio-0.1.0-cp313-cp313-win_amd64.whl (339.6 kB view details)

Uploaded CPython 3.13Windows x86-64

blazio-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

blazio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (240.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

blazio-0.1.0-cp312-cp312-win_amd64.whl (339.6 kB view details)

Uploaded CPython 3.12Windows x86-64

blazio-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

blazio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (240.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file blazio-0.1.0.tar.gz.

File metadata

  • Download URL: blazio-0.1.0.tar.gz
  • Upload date:
  • Size: 66.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for blazio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2081ccba81aa92afe6019f93d1ad5e4ae09c77a18c3531ca1e46b01295eccc79
MD5 d97d381897df77eeb5610c746a3242d5
BLAKE2b-256 b69a2fa62a23be423b1fdddecb0d16f3ce58df5bbd6e8941003dfc9f1faff7be

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0.tar.gz:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: blazio-0.1.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 350.0 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for blazio-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 5d71b0e9b4efd9800f9b7434fe87e2e8a28917f69c268614a2d7a86fdac77b66
MD5 90d4c71191d46831bb5371b7f16a3eed
BLAKE2b-256 e51e426bb322f2ec982c268a1318cdb7d99bfa724457b1a5c9e20efceee9baba

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp314-cp314-win_amd64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9110f56c48118021060a8494aaac804065c3b8621a5ec5adcfacc58999bb4e2f
MD5 9446a1c4c522b9ca2d6b6b86da10b4ee
BLAKE2b-256 09cc4f47a782c20f48a15eee61c5c82a2b6dcee62d87fb42b75e1f05b0f0aa50

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8257ad530c3119a365e8af8ee0d869904ee551926d309ad6869ca0a69d8ff47
MD5 4238bd1173993cd06fe0e5a8518c0259
BLAKE2b-256 0b5c2b944fd373c104608df14f045e4c42cd5deda1918231b43ae23f6d5e70b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: blazio-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 339.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for blazio-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 36c70971a9e21eed754ca9e210c28e0338bf7f6f30838310489ebb4d0bc690e3
MD5 d72dda08211af9564faa2874d838fa78
BLAKE2b-256 ed3efbbbab6f995c49641d02f66752e738345152b6f4839b2c48329bd7ea2d82

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 83d91e1a09594c5945d2a39caee45002e026930f188093c03d1c009f66c752b4
MD5 982fb9f811fe085b16017c9b799521fe
BLAKE2b-256 f1fb068edd890c1537df7f7be8e90b8e009a336190eaaeaf84932d6314b4c738

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f3919c50dc61dff97812a474eba3581b6987a037177b8da6f180fec54532119
MD5 4ead81b29b695922ecea4a779949de49
BLAKE2b-256 325563f06131ed1081644d297e36d30f7f6aae3df8b068d31a44ff88f397f809

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: blazio-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 339.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for blazio-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f4901d3d4c266f0193a4db490281e07dd1ac2d025f10b55adffc06fd4eabf1ce
MD5 2d95215be3a9040fcaeaa7594d96f515
BLAKE2b-256 625135f369c325d4fb9a420520a14305a0d73516ca3bbd98b21d1c5a3ee8fee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bcd31f3a022e043156a334dffad213c4cb26df43f28bcc1210b6beb9d7070650
MD5 bae56d400c7cb5a37b8e5314c5c8bdd7
BLAKE2b-256 70ed7a29941e90e24e433ffb56da2d0f7c0f5793d5031aa2fed6d3069dbf2de9

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blazio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blazio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df75be4bb5018f7cb614a736a82433aba83086e380f041c970ec725b3b137d9a
MD5 044b1d48debfa11eedcd5a7c16199ca1
BLAKE2b-256 5b32d563881c6c7be69f516c8a21463bfda73759c26e4eb6ccb8acacdfba2b16

See more details on using hashes here.

Provenance

The following attestation bundles were made for blazio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on lalinsky/blazio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

10 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page