Ploom brings replayable schedule exploration to Python concurrency tests
state: expiredheat: lowuncertainty: mediumrelevance: mediumpython-concurrency testing developer-toolsAdil Zouitine
What is this?
Adil Zouitine’s Ploom is a Python concurrency-testing tool presented in a Show HN post and documented in its GitHub repository. It runs tests with Ploom’s controlled scheduler, explores interleavings of supported Ploom operations, and saves replayable traces when assertions fail. Its stated scope is limited: it does not observe ordinary threading primitives or external side effects, detect data races, or model weak-memory effects; exhaustive exploration can also be costly, so search limits may be used.
Why it matters
Ploom brings controlled-scheduler, replayable concurrency testing—an approach already used in other language ecosystems—to Python. For small scenarios written with its supported primitives, systematically trying thread schedules could expose order-dependent bugs that ordinary repeated tests miss, then make failures reproducible. Its narrow instrumentation requirements and potentially expensive schedule search limit how broadly it applies.
Current assessment
Adil Zouitine announced Ploom in a Show HN post; the linked GitHub repository documents an installable Python package with a Python API, pytest fixture, and command-line interface. The repository says Ploom explores schedules of its own Thread, Lock, and SharedCell operations, saves and minimizes failure traces, and can replay a saved schedule. It supports standard CPython 3.13/3.14 and free-threaded CPython 3.14, according to the project. Important limits: it only observes Ploom operations, models them as sequentially consistent, does not detect data races, and does not cover ordinary threading primitives, I/O, external side effects, or weak-memory behavior. Each schedule runs in a fresh process; the project reports about 0.1 seconds per schedule and offers bounded-preemption searches, with a limit explicitly treated as incomplete rather than a pass. The project says it is inspired by Rust’s Loom but does not implement Loom’s C11 memory model or partial-order reduction. Evidence here establishes the release and the author’s described capabilities, not independent validation, adoption, or performance comparisons.
Measured heat
no measured readings yet — the hourly heat pass fills this in
How the heat travelled
Evidence (2) — ⭐ canonical anchor
| source | object | author | score | comments |
| 🟧 hn | Show HN: Ploom, find thread bugs in Python by trying every interleavingRetrieved article excerptOpen article · Retrieved 2026-10-26T18:28:55.468326+00:00 # ploom
[CI](https://github.com/AdilZouitine/ploom/actions/workflows/ci.yml)
[Coverage](https://codecov.io/gh/AdilZouitine/ploom)
[CodSpeed](https://app.codspeed.io/AdilZouitine/ploom)
[Python](https://docs.python.org/3/howto/free-threading-python.html)
[License](https://github.com/AdilZouitine/ploom/blob/main/LICENSE)
[Ruff](https://github.com/astral-sh/ruff)
[uv](https://github.com/astral-sh/uv)
**Find thread bugs in Python. Replay the schedule that failed.**
A thread bug depends on which thread runs next. A test can pass a thousand times
and still miss the bad order. Ploom runs your test under a controlled scheduler.
It tries every order of ploom operations, stops at the first failure, and saves
that order as a JSON trace. Replay the trace to get the same failure again.
[Documentation](https://ploom.readthedocs.io/) · [Guide](https://ploom.readthedocs.io/guide/) · [Guarantees](https://ploom.readthedocs.io/semantics/) · [Python API](https://ploom.readthedocs.io/api/) · [Development](https://ploom.readthedocs.io/development/)
## Install
```
uv add --dev ploom
# or
pip install ploom
```
## Example: two withdrawals from one account
Mathieu and Lucas share an account that holds 100. They both withdraw 100 at the
same time. Only one withdrawal must succeed.
```
import ploom
def scenario():
balance = ploom.SharedCell(100)
def withdraw():
if balance.read() >= 100:
balance.write(balance.read() - 100)
mathieu = ploom.Thread(target=withdraw)
lucas = ploom.Thread(target=withdraw)
mathieu.start()
lucas.start()
mathieu.join()
lucas.join()
assert balance.read() >= 0, "the account is overdrawn"
ploom.check(scenario)
```
`SharedCell` holds a value that the threads share. `ploom.Thread` is a thread
that ploom schedules. With `threading.Thread`, this code passes almost every
time. Ploom tries the possible orders and finds the bad one in a few seconds:
```
ploom.exploration.ModelCheckError: builtins.AssertionError: the account is overdrawn
Original trace: .ploom/f981…-original.json
Minimized trace: .ploom/f981…-minimized.json
```
The minimized trace shows the bad order:
1. Lucas reads the balance: 100. He can withdraw.
2. Mathieu reads the balance: 100. He can withdraw.
3. Mathieu withdraws. The balance is 0.
4. Lucas withdraws. The balance is -100.
To fix the bug, hold a lock during the check and the withdrawal:
```
lock = ploom.Lock()
def withdraw():
with lock:
if balance.read() >= 100:
balance.write(balance.read() - 100)
```
Now all 127 orders pass, and `ploom.check` returns the exploration statistics.
[`examples/bank_account.py`](https://github.com/AdilZouitine/ploom/blob/main/examples/bank_account.py) contains the version
without the lock.
## Use it in pytest
The `ploom_check` fixture explores a scenario inside a test:
```
def test_withdraw(ploom_check):
ploom_check(scenario)
```
When the test fails, ploom prints the command that replays the failure:
```
ploom first failure: .ploom/ID-original.json
Replay: pytest tests/test_bank.py::test_withdraw --ploom-replay=.ploom/ID-original.json
```
## Replay a failure
Replay runs one saved schedule. It does not search. Run the printed command:
```
uv run pytest tests/test_bank.py::test_withdraw --ploom-replay=.ploom/ID-original.json
```
A module-level scenario can also use the command line:
```
uv run python -m ploom check examples.bank_account:scenario
uv run python -m ploom replay .ploom/ID-minimized.json
```
Replay stops with `ReplayDivergenceError` if the scenario's source file, the
Python minor version, or the recorded operations changed.
## How it works
1. Each ploom operation is a scheduling point. Only one task runs at a time, so
the result does not depend on the GIL.
2. A depth-first search tries each runnable task at each scheduling point.
3. Each schedule runs in a fresh Python process. Python state from one schedule
does not leak into the next. All processes use the same hash seed, so set
order does not change between schedules.
4. At the first failure, ploom saves the trace. Then it looks for the same failure
with fewer preemptions and saves a minimized trace. A preemption is a switch
away from a task that could continue.
5. A search limit raises `IncompleteExplorationError`. A limit never counts as a
pass.
A fresh process costs about 0.1 seconds per schedule. Keep scenarios small. For
larger scenarios, set `Config(max_preemptions=2)` to explore every schedule with
at most two preemptions.
## Scope
| Area | Supported |
| --- | --- |
| Threads | `Thread(target, args, kwargs)`, `start`, `join`, `is_alive` |
| Locks | `Lock`: blocking and nonblocking `acquire`, `release`, `locked`, `with` |
| Shared state | `SharedCell` reads and writes of immutable values, `yield_now()` |
| Entry points | Python API, pytest fixture, `python -m ploom` |
| Interpreters | Standard CPython 3.13 and 3.14, free-threaded CPython 3.14 |
Ploom sees only ploom operations, and it models them as sequentially consistent.
It does not see `threading` locks, `Event`, `Queue`, I/O, or weak-memory effects.
It does not detect data races. Your assertions find the bugs.
Ploom does not roll back files, network calls, or other external effects between
schedules.
## Develop
```
uv sync --locked
make check
```
Run `make docs` to build the documentation. The [development guide](https://ploom.readthedocs.io/development/)
covers benchmarks and CI.
## Acknowledgment
Ploom is inspired by [Loom](https://github.com/tokio-rs/loom), the concurrency
testing library for Rust. Loom showed how to explore schedules and reproduce
failures. Ploom defines its own Python operations. It does not implement Loom's
C11 memory model or its partial-order reduction.
## License
Ploom is licensed under [Apache-2.0](https://github.com/AdilZouitine/ploom/blob/main/LICENSE). | AdilZtn | 1 | 0 |
| 🟧 echo.github ⭐ | The linked GitHub repository is the originating artifact for Ploom: “Find thread bugs in Python. Replay the schedule that failed.” Its READM | Adil Zouitine (AdilZtn) | — | — |
Interpretation history
2026-10-26T18:30:50Z
audience grounding: medium — Ploom brings controlled-scheduler, replayable concurrency testing—an approach already used in other language ecosystems—to Python. For small scenarios written with its supported primitives, systematically trying thread schedules could expose order-dependent bugs that ordinary repeated tests miss, then make failures reproducible. Its narrow instrumentation requirements and potentially expensive schedule search limit how broadly it applies.
Decision trace
- 11-10 06:20expireexpired deterministically: single-evidence seed quiet 14 days (lifecycle)
- 10-27 05:32attention_candidatecreate
- 10-27 05:32promote_anchororigin walk conf 0.9
- 10-27 05:30groundPloom brings controlled-scheduler, replayable concurrency testing—an approach already used in other language ecosystems—to Python. For small scenarios written with its supported primitives, systematic
- 10-27 05:30createPloom is a usable, specific developer tool, but the evidence is a single Show HN post with little engagement and no adoption signal.