loopmini
A boring, maintainable, drop-in event loop for asyncio applications on Linux and Mac. It tracks CPython, stays sound under Ctrl-C, and shares its reactor with Rust.
import asyncio, loopmini
async def main():
await asyncio.sleep(0.1)
return await asyncio.to_thread(lambda: 42)
asyncio.run(main(), loop_factory=loopmini.new_event_loop)
Install
pip install loopmini
Design
The Python side subclasses asyncio.AbstractEventLoop and reuses the stock Task, Future, Handle, and sslproto machinery. Contextvars, cancellation, and task introspection therefore behave exactly as in the standard loop. CPython releases change little that loopmini must track, because the version-sensitive objects are CPython's own.
The Rust side owns fd readiness, timers, and cross-thread wakeup. A small level-triggered reactor core (the polling crate, kqueue/epoll) is hosted on a Tokio current-thread runtime, which waits on the reactor's own pollable fd. This split preserves the level-triggered add_reader contract that asyncio requires and Tokio's edge-triggered driver cannot express. Rust futures spawned on the runtime advance during every blocking poll, with the GIL released, on the same thread and reactor as the Python loop.
Compatibility
Four external test suites act as conformance oracles, run with pytest -m oracle: CPython's own test_asyncio, and the suites of anyio, uvloop, and aiohttp, about 7,000 tests in all. All four pass. The few exclusions are listed with reasons in tests/test_oracle.py.
Interrupts
A KeyboardInterrupt injected while the loop runs (the kernel interrupt mechanism, and the delivery path of Ctrl-C) leaves the loop in a resumable state. Each scheduled callback either runs or remains queued. The standard loop can lose the callback in the same situation. The test suite injects interrupts under stream, timer, and cross-thread load to hold this guarantee, and the loop must keep serving afterwards.
Performance
Throughput matches the standard loop on real I/O workloads. A 30-second soak serving a fasthtml app under concurrent HTTP and websocket load holds a 2.6ms median response with no fd or memory growth. Microbenchmarks run 5 to 15% slower than the standard loop, and creating a task costs about twice as much, because each schedule crosses the Python/Rust boundary. uvloop is faster where speed is the requirement.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loopmini-0.1.1.tar.gz.
File metadata
- Download URL: loopmini-0.1.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a378075dcd5bd593b0b62a06e96fb3588c1749868c9120960ab1c7edffc17e8
|
|
| MD5 |
65290253f830c978b1385ce9aa4e7cde
|
|
| BLAKE2b-256 |
f2137fabba36a30908f597ce0ef718171bd69eebdbfa92c4789b52d71afbbccf
|
Provenance
The following attestation bundles were made for loopmini-0.1.1.tar.gz:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1.tar.gz -
Subject digest:
1a378075dcd5bd593b0b62a06e96fb3588c1749868c9120960ab1c7edffc17e8 - Sigstore transparency entry: 2624364413
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 393.1 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5618c1ca3551aaeba4c344ce0724c5526c25c220f1fa52f87cf14032cbaef0e7
|
|
| MD5 |
5e9de13e280e11c7257a9a5b21ca4d82
|
|
| BLAKE2b-256 |
36abe2e80ecc75cb0af3a0c0515169b082e4d5e458591e0cc3f8aa1f9476f44e
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5618c1ca3551aaeba4c344ce0724c5526c25c220f1fa52f87cf14032cbaef0e7 - Sigstore transparency entry: 2624364511
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 347.3 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
679f801b53d3c2fd08a64098d5d0bcc63199f68d5cb415de1826088a3ee2601c
|
|
| MD5 |
ea4644791e802bbbacdba03478d9065d
|
|
| BLAKE2b-256 |
96c792f63ab76da68483ca47e8089685feab617a92837d994df0dfe165c37c59
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
679f801b53d3c2fd08a64098d5d0bcc63199f68d5cb415de1826088a3ee2601c - Sigstore transparency entry: 2624364757
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 393.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3c8503c16fa060cf5e6152bf3f4218e1f7cb1bb7ecbfb48df4b6581479ed3db
|
|
| MD5 |
f029c8cf610eb5d350f98e258da53055
|
|
| BLAKE2b-256 |
a9a863ea08c2f32c281054334ee86cbb5e1b5aaa035304dc1fdddb64885575e6
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
e3c8503c16fa060cf5e6152bf3f4218e1f7cb1bb7ecbfb48df4b6581479ed3db - Sigstore transparency entry: 2624364573
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 348.8 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8451bfddfbf723918501fcd666451946b19525699a44771ad79cd777c44818d
|
|
| MD5 |
60da56215e86a6e0e594f34936e537a0
|
|
| BLAKE2b-256 |
7c102e313a95d9bb7d6ccbaf3e5229b0bb943682b6a71d7a40a94aa83409caf2
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
c8451bfddfbf723918501fcd666451946b19525699a44771ad79cd777c44818d - Sigstore transparency entry: 2624364479
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 400.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71f70c3213f74d8e08d836d8e0bc4f62a14a0e5f5ff8f77e47a1b4123c480077
|
|
| MD5 |
6684a93bc161192e4e4b1582353627ea
|
|
| BLAKE2b-256 |
fffc86e5867fe586921a977947e0973f14d05ad24b1f6b7384e978d992592bd7
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
71f70c3213f74d8e08d836d8e0bc4f62a14a0e5f5ff8f77e47a1b4123c480077 - Sigstore transparency entry: 2624364725
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 356.2 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ea4a3e183aa46564be60470786ac005082c40158f3c3a78ec22b9bf313ffbb9
|
|
| MD5 |
dc9b1b5ef6c4ed44cf444f96342c201f
|
|
| BLAKE2b-256 |
a479566d75f34cdc1c5f1005aa5036bf3105fd7dbc78df0c77e1889a2e0c818f
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
9ea4a3e183aa46564be60470786ac005082c40158f3c3a78ec22b9bf313ffbb9 - Sigstore transparency entry: 2624364450
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 399.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c664ca9c7550e7de4eecf4424b5519d61c51f9373326a56733ad3b5e38f970
|
|
| MD5 |
a6ec66e7826f733ae13ab98a275d9e99
|
|
| BLAKE2b-256 |
4bcf8def9d6a4198a20d9be7afc5ac48b541bd5b5fefe1f7de038d7e407976d6
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
32c664ca9c7550e7de4eecf4424b5519d61c51f9373326a56733ad3b5e38f970 - Sigstore transparency entry: 2624364665
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file loopmini-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: loopmini-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 356.8 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4701e46b4c316be9efda027ccc02b21f3a0c6fc5afec63f0020cfad4062f65e8
|
|
| MD5 |
d023f8432b0ef0019a9ab7a0bb82661e
|
|
| BLAKE2b-256 |
44631af67d9e63e3458315366f8013a2aac9980c163e6e29cc746e2d7e3d2e6c
|
Provenance
The following attestation bundles were made for loopmini-0.1.1-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
ci.yml on AnswerDotAI/loopmini
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loopmini-0.1.1-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
4701e46b4c316be9efda027ccc02b21f3a0c6fc5afec63f0020cfad4062f65e8 - Sigstore transparency entry: 2624364620
- Sigstore integration time:
-
Permalink:
AnswerDotAI/loopmini@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/AnswerDotAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f391c7242b5fe8f441d7ecb65376c81e76a2fc6 -
Trigger Event:
push
-
Statement type: