Skip to main content

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.BaseEventLoop and reuses its task, future, executor, error-handling, networking, server, sendfile, and subprocess machinery. Reactor-neutral socket, Unix, pipe, and accept implementations come directly from CPython's selector loop. Loopmini supplies the scheduling and fd-readiness hooks plus socket and datagram transports, so version-sensitive asyncio behavior remains CPython's own.

The Rust side owns fd readiness, timers, and cross-thread wakeup through a small level-triggered reactor core (polling, using kqueue/epoll). The Python driver blocks directly in the reactor with the GIL released. The same PyO3-free core is available to Rust consumers; embedding runtimes can run futures on their own workers and wake the Python loop through its thread-safe scheduling path.

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. There is a small overhead involved in getting the better interrupt semantics, due to having to cross the Rust boundary. It applies only when something is scheduled onto the loop, and is then under 1µs per operation: create_task, an await that suspends, asyncio.sleep, or call_soon. Code that stays inside Python, including an await that does not suspend, pays nothing. The median overshoot of a 1ms timer is ~0.2ms, similar to Python's standard loop.

Metadata

Release files for loopmini 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loopmini 0.2.3
File Size Uploaded
loopmini-0.2.3.tar.gz 35.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for loopmini 0.2.3
File
loopmini-0.2.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
loopmini-0.2.3-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
loopmini-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
loopmini-0.2.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
loopmini-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
loopmini-0.2.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
loopmini-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
loopmini-0.2.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 2.1 MB

Release files / loopmini-0.2.3.tar.gz

Download URL loopmini-0.2.3.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
933dfdb4d855b7291d9da01bf98ba72b8577050146633412ccfd7babbe740f5e
BLAKE2b-256 checksum
How to use checksums
0e1e4b20e742c7965165f458c2bcac73f83438065b4f59722908946a9c6aab3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL loopmini-0.2.3-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 269.2 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a4d672a79a22c308ef2a42dcefd5676b0d63060fbd776fd749dc26c849c8b7ed
BLAKE2b-256 checksum
How to use checksums
7f2d1df836ee50db9da979bcbbf890d187b96201cce4e6c20c8bfa60c04b0b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp314-cp314-macosx_11_0_arm64.whl

Download URL loopmini-0.2.3-cp314-cp314-macosx_11_0_arm64.whl
Size 250.7 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
873711fbd759e297bf05effbbb73b7fa9d83b5b7e26db8549d58970384d7d693
BLAKE2b-256 checksum
How to use checksums
fefe4a19ba7f7a6cbfa674bd2ce1f6aaf7925dce9ed314e97d3778f88eff3d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL loopmini-0.2.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 268.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cee28187e3de9160a804f7e3cebc3ec2b03be42e7afde05a99fb31fd95f00f1f
BLAKE2b-256 checksum
How to use checksums
a56cfef6fdebec9d286d77a98867d7b481b033c43761460ac8e6efbee3112bd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL loopmini-0.2.3-cp313-cp313-macosx_11_0_arm64.whl
Size 250.7 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8fcd7a655998fc4a54f5e9ac6963c15ea79d6e245b225b2bd3466b8e5729c990
BLAKE2b-256 checksum
How to use checksums
392b387999659a95ea7efe3b0dc0cbf1e65fbc414542aee01eb0bd8546872a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL loopmini-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 268.9 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b89fa3c1f9d43a180346caa2558af06d39db66877513cb494ce83caf5d3c5d13
BLAKE2b-256 checksum
How to use checksums
380dd254f5267deb4b7e6a13191d4b9cfa5f57c897deb69c714ab3851df13305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL loopmini-0.2.3-cp312-cp312-macosx_11_0_arm64.whl
Size 250.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b5a2deb8d75ae42e31560b606623b07fb5880406510e2e6dc79160612b6dc1ba
BLAKE2b-256 checksum
How to use checksums
5fa16ed4013663674ed7e6403435f3051a3576a07981524baeaf7eda3e5d09a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL loopmini-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 269.5 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4db94f5c5a72656884005f2dc3744db07588fa8e1e178596d953424ac8475949
BLAKE2b-256 checksum
How to use checksums
550bc591968ba8adef4ad5ab8fa09a925da43031464496e2d28269de4b23eda5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / loopmini-0.2.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL loopmini-0.2.3-cp311-cp311-macosx_11_0_arm64.whl
Size 253.0 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2390f6050806aa12bfa2e7031fcebe2ef096eadad93c356ff0723bebf7924a43
BLAKE2b-256 checksum
How to use checksums
6daf985603c938f72f2dd90a1d4da305b08a8f914b609a316ad684a7264896d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.3 This release

9 release files

0.2.2

9 release files

0.2.1

9 release files

0.1.1

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page