Show HN: Python Concurrency Testing with Frontrun

lucaswiman1 pts0 comments

Hi HN, I m the author of Frontrun, a Python concurrency testing library I built over the past 6 months using Claude Code and Codex. It uses bytecode tracing and various forms of monkeypatching to schedule across threads, async and multiprocessing allowing you to find and deterministically reproduce race conditions or deadlocks.It can understand Python variable assignments, SQL statements and Redis commands, which can detect races that cross abstraction boundaries, e.g. a deadlock between threading.Lock() in one thread and a SQL row lock in another.To use it, do `pip install frontrun`[1] then put the following in a pytest case: result = frontrun.explore( setup=Counter, workers=Counter.increment, count=2, ) result.assert_holds() Then use `frontrun pytest path/to/test_counter.py`.My hope is that this will allow authors of libraries which are not currently threadsafe to weather the freethreading transition more easily or to raise the bar for issue submissions involving race conditions. I ve put a lot of work into making races deterministic and making the error trace interpretable, demonstrating why that sequence of events that triggers the race. I d love any usability feedback or success/failure stories you have, and I m happy to answer any questions about how it works.[1] MacOS and Linux only.

frontrun python code race concurrency testing

Related Articles