Skip to main content

retryflake

ci

Run flaky commands with retries, exponential backoff, and jitter. One binary, zero dependencies — for the CI step that fails every third run, the deploy script that hits a rate limit, the pip install that drops once a week.

pip install retryflake

retryflake --retries 5 -- make test
retryflake --retries 5 --timeout 120 -- ./deploy.sh
retryflake --retry-on "rate limit" --retry-on "429" -- ./call-api.sh
retryflake --retries 0 -- ./must-pass-once.sh

Output streams live to your terminal exactly as the command produces it; retryflake's own chatter (attempt 2/4 failed (exit 1), retrying in 3.2s) goes to stderr, and --quiet silences it.

Behavior

  • Exit code is the command's exit code: 0 on success, the last attempt's code on failure, 124 if an attempt was killed by --timeout, 127/126 if the command can't start (no pointless retries), 130 on Ctrl-C (interrupts the child too, never retried).
  • Backoff is delay * 2^attempt, capped at --max-delay (defaults: 1s base, 60s cap), with full jitter on by default (--no-jitter disables it).
  • --timeout kills the whole process group per attempt: SIGTERM, then SIGKILL after a 5s grace period. Timeouts always retry.
  • --retry-on (repeatable) retries only when the attempt's output contains the substring — retry on rate limit, not on invalid API key. A bounded 128 KiB tail is kept for matching, so memory stays flat on huge logs.

Reference

Flag Default What it does
--retries N 3 retries after the first attempt
--delay S 1.0 base backoff in seconds
--max-delay S 60.0 backoff cap in seconds
--jitter / --no-jitter on full jitter on the backoff
--timeout S none kill each attempt after S seconds
--retry-on SUB none only retry when output contains SUB
--quiet off suppress retryflake's stderr chatter

POSIX only (Linux, macOS). Python 3.9+.

License

MIT.

Metadata

Release files for retryflake 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 retryflake 0.1.0
File Size Uploaded
retryflake-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

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

Total release size: 12.5 kB

Release files / retryflake-0.1.0.tar.gz

Download URL retryflake-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
778d59ad71dc06add1e9ed174d41bdd80064e76bee22d17c306790e699fdfd12
BLAKE2b-256 checksum
How to use checksums
350595118a3e5ca8e34bb6f8618551d0c6df4632ae2c62723b52738e813805c2
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 Oct 11, 2026.

Transparency log

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

Download URL retryflake-0.1.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17ea87ad615248380a4850a7345ccd9b6e5bf32a5a718093c82f46df2894ca42
BLAKE2b-256 checksum
How to use checksums
ff4654c4c424e91a20d387f776b1aa7f83d09f91de26ee0a5a4b1ea98d586e93
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 Oct 11, 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