Skip to main content

serp-asyncio

Drop-in asyncio for Serpentine (docs/DECISIONS.md D45).

import asyncio

async def worker(name: str, q: Owned[asyncio.Queue]) -> int: ...

async def amain() -> None:
    q: asyncio.Queue = asyncio.Queue(10)
    t: asyncio.Task[int] = asyncio.create_task(worker("a", q))
    rs: list[int] = await asyncio.gather(worker("b", q), worker("c", q))
    n: int = await t
    lock: asyncio.Lock = asyncio.Lock()
    async with lock:
        await asyncio.sleep(0.01)

asyncio.run(amain())

What lives where

asyncio. member where
run, sleep, create_task(f(args), name=), gather(c1(), c2()), Task[T], await task, task.done(), TimeoutError compiler + runtime (no package needed)
Event, Lock, Semaphore, BoundedSemaphore, Queue, QueueEmpty, QueueFull this package (import asyncio routes them to serp_asyncio)

Tasks are OS threads that pass a baton: exactly one runs at a time and scheduling replays CPython's _run_once (FIFO ready queue, I/O-ready tasks, then expired timers), so a program prints the same interleaving under CPython and natively. The primitives are runtime-held handles, so they can be passed to tasks as Owned[asyncio.Queue] etc.

Divergences

  • No cancellation (cancel(), CancelledError), Task.result(), wait_for, timeout, Condition, async for, gather(*coros), return_exceptions=.
  • gather must be the whole right-hand side of an assignment / return or a bare statement, and all its coroutines must return the same type (a list[T]).
  • A task may be awaited once; create_task takes a direct call to an async def function with Send arguments (int/float/bool/str/bytes/scalar classes such as the primitives here).
  • One event loop per process; tasks still pending when asyncio.run returns are abandoned.
  • Queue items are PyVal; Queue.maxsize is a property.
  • Keep sleeps that must order deterministically ≥ 20 ms apart: Windows CPython's monotonic clock has 15.6 ms resolution and fires close timers together.
  • Under CPython the socket async mode used by Fang/Venom is a no-op — network I/O there blocks the loop (results match, interleavings need not).

Metadata

Release files for serp-asyncio 0.1.0

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

Source distribution (sdist)

Source distribution for serp-asyncio 0.1.0
File Size Uploaded
serp_asyncio-0.1.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-asyncio 0.1.0
File Interpreter ABI Platform
serp_asyncio-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / serp_asyncio-0.1.0.tar.gz

Download URL serp_asyncio-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
430afd19f869402981e1556b7e50973422bdc8682a94966a73c4f2fa53782884
BLAKE2b-256 checksum
How to use checksums
1485dcdee4946307159ffa2e20905f4432216311dedb53c5e9ecf22ec6854f4c
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 Sep 29, 2026.

Transparency log

Release files / serp_asyncio-0.1.0-py3-none-any.whl

Download URL serp_asyncio-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5186b9d50d597464c7a28a09581ab0ead1e3c3b8906e051f7b96fdd0a622f6c6
BLAKE2b-256 checksum
How to use checksums
7a06e4d3aa2b2052c1641a858ebd5426600be5a84106d25a761ae780f437dad2
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 Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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