Skip to main content

serp-threading

Drop-in replacement for CPython's threading module (D9 v2). Thread and Timer are language intrinsics; the sync primitives are runtime-held handles (Mutex/Condvar tables in the runtime, no crates). Under CPython the serp_threading_core delegate mirrors the same state machines on stdlib threading, so output is byte-identical across both worlds.

API

  • Thread(target=f, args=(...), name=None, daemon=False) → .start(), .join(timeout=None), .is_alive(), .name, .ident, .daemon. Timer(interval, function, args=()) adds .cancel(). The target is a named module function whose parameters are Send-by-copy: int/float/bool/str/bytes, or Owned[C] where C is a dataclass made only of those scalars (the sync primitives below qualify). Non-daemon threads are joined when main() returns, like CPython.
  • Lock, RLock — acquire(blocking=True, timeout=-1), release(), locked(), with.
  • Event — set/clear/is_set/wait(timeout=None).
  • Semaphore(value=1), BoundedSemaphore(value=1) — acquire(blocking, timeout), release(n=1), with.
  • Condition(lock=None) — acquire/release/wait(timeout)/wait_for(pred, timeout)/notify(n)/notify_all(), with.
  • Barrier(parties, timeout=None) — wait(timeout), reset(), abort(), parties, n_waiting, broken; BrokenBarrierError.
  • local() — thread-local store: set(name, value), get(name, default=None), has(name), delete(name).
  • current_thread(), main_thread() (.name/.ident/.daemon), get_ident(), get_native_id(), active_count(), TIMEOUT_MAX.

Divergences

No shared mutable objects cross the thread boundary — hand data over through serp_queue (deep-copied PyVal items) or thread return values. Thread targets must be module functions (no lambdas/bound methods, no kwargs=); Thread.name is read-only; local() uses get/set/has/delete instead of attribute access; uncaught thread exceptions print Kind: message to stderr; no enumerate(), excepthook, settrace/setprofile, stack_size.

Install

serp add serp-threading
pip install serp-threading

Metadata

Release files for serp-threading 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-threading 0.1.0
File Size Uploaded
serp_threading-0.1.0.tar.gz 9.2 kB Details

Built distribution (wheel)

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

Total release size: 17.6 kB

Release files / serp_threading-0.1.0.tar.gz

Download URL serp_threading-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5efe60fb149f26969afc4b06ebc1e6b079fdd4d57601cf753f77fe312cec295f
BLAKE2b-256 checksum
How to use checksums
c7afe389bb49e9a931d13ddbbe91c2d82f73ff2a033888b93831d7028870c09e
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_threading-0.1.0-py3-none-any.whl

Download URL serp_threading-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb9c788a58d9954791fc9da6017ab622253b9cd8675986df50cf388badb12cc3
BLAKE2b-256 checksum
How to use checksums
a1e99e01676b9e975664fd0fa3f474627ba6584c94966b4774e15fe30f2601ae
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