Skip to main content

Heisenrun

Heisenrun is a small CLI tool for reproducing heisenbugs by running many instances of a command in parallel.

Heisenbugs are bugs that appear only under certain timing or concurrency conditions and disappear when you try to debug them. Heisenrun increases the chance of triggering such bugs by repeatedly executing a command concurrently.

Typical use cases:

  • Reproducing flaky tests
  • Triggering race conditions
  • Stress-testing CLI programs
  • Detecting nondeterministic behavior

Getting Started

Using uv:

uv tool run heisenrun --help

Example:

uv tool run heisenrun -n 10 -m 2 -- sleep {#}

This downloads and installs heisenrun into an isolated environment. If you wish more control please consider the next command.

You can explicitly also heisenrun with uv:

uv tool install heisenrun

Then run:

heisenrun --help

The uv tool install command gives you more control. You can specify the tool's version, manually upgrade it, remove it, and etc.

Install with pipx

pipx also installs CLI tools in isolated environments:

pipx install heisenrun

Then run:

heisenrun --help

Global installation via pip works but is generally discouraged for CLI tools:

pip install heisenrun

Examples

Run a command 10 times

All 10 processes are created instantly. They run in parallel.

heisenrun -n 10 -- sleep 1

Use run index {#}

Use {#} in command to insert the index of the current run:

heisenrun -n 10 -- sleep {#}

Example expansion:

sleep 0
sleep 1
sleep 2
...
sleep 9

Limit parallelism

The -m option allows you to specify the maximum number of commands running in parallel. This will take about 5 seconds.

heisenrun -n 10 -m 2 -- sleep 1

Set timeouts

Abort runs that take too long:

heisenrun -n 10 -t 5s -- sleep {#}

Example report:

   Execution Report
┏━━━━━━━━━━┳━━━━━━━━━┓
┃ Instance ┃ Status  ┃
┡━━━━━━━━━━╇━━━━━━━━━┩
│        0 │ SUCCESS │
│        1 │ SUCCESS │
│        2 │ SUCCESS │
│        3 │ SUCCESS │
│        4 │ SUCCESS │
│        5 │ SUCCESS │
│        6 │ TIMEOUT │
│        7 │ TIMEOUT │
│        8 │ TIMEOUT │
│        9 │ TIMEOUT │
└──────────┴─────────┘

Capture outputs

Store outputs (stdout and stderr) of each run in a directory:

heisenrun -n 50 -o outputs -- ./program

Example directory structure:

outputs/
  0_output.txt
  1_output.txt
  ...

Metadata

Release files for heisenrun 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 heisenrun 0.1.0
File Size Uploaded Provenance Actions
heisenrun-0.1.0.tar.gz 4.9 kB Without provenance Details for heisenrun-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.0 kB

Release files / heisenrun-0.1.0.tar.gz

Download URL heisenrun-0.1.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
85ff8c4f51330131c43b28359bf1b8a6296db6132127f3514c49355db73cdb0a
BLAKE2b-256 checksum
How to use checksums
5954e82f923f9aafd2f1a08da9522b5684c83f9630e4d2b0377ae882d6c88f32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL heisenrun-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9e2b61414a04f0ce7761ede704d247915f5b0f8a899f9e5f874751b28564f94
BLAKE2b-256 checksum
How to use checksums
de83067490e8e8382fbf415514c58f9c3d10212ef0c96040bcd124de6f70dfdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for heisenrun 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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