Skip to main content

A simple CLI utility to run shell commands with automatic retries on failure.

Project description

retry-cli

Ruff PyPI Latest Release License Python Versions CI Status

A utility to run a shell command a set number of times with automatic retries on failure.

Mainly created as having tools such as pre-commit, format, etc fail once then pass the second time is (to me!) quite annoying. Often they'll fail once, then pass the second time.

Example usage:

uvx --from retry-cli retry --command "pre-commit run --all-files"

Usage

usage: retry [-h] --command COMMAND [--retries RETRIES] [--show-first] [--success-code SUCCESS_CODE]

Run shell command with automatic retries on failure.

Usage Examples:
  retry --retries 4 --show-first --command "pre-commit run --all-files"

Useful for auto-formatters and tools like pre-commit, which might fail one or
more times but ultimately pass.

options:
  -h, --help            show this help message and exit
  --command COMMAND     The command string to execute.
  --retries RETRIES     Number of retries after the first attempt (default: 2).
  --show-first          Show output of the first attempt (default: hidden).
  --success-code SUCCESS_CODE
                        The exit code that indicates success (default: 0).

Installation

Given this is a simple CLI tool it's recommended to use pipx / uvx to run with.

uvx

# PyPI
uvx --from retry-cli retry --command "pre-commit run --all-files"
# GitHub
uvx --from git+https://github.com/geo7/retry-cli.git retry --command "..."

Development

make init   # setup project
make test   # run tests
make blast  # run linting

Release

Manual release process, merge feature into main then:

Run release script:

make release VERSION=0.1.0

Push commit:

git push origin main v0.1.0

Which will trigger GitHub Release workflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retry_cli-0.1.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

retry_cli-0.1.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file retry_cli-0.1.3.tar.gz.

File metadata

  • Download URL: retry_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for retry_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7c3411689a91a20179a69dbd6fb38922f09066717fba385ea0a46bfa53375b3b
MD5 69df25d6606ad1936c0db9b465498784
BLAKE2b-256 1eacd1da72fcb5742205bd3e2b483f38893d0c858a6bd888ff5a760b4edaa745

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_cli-0.1.3.tar.gz:

Publisher: release.yml on geo7/retry-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file retry_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: retry_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for retry_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 00ea734dffa031888b37846dcdd3438dce95390b61c4a4b25039d0074c0cfb4b
MD5 b85a86c8d463b1c22a80aba259513e05
BLAKE2b-256 a781213d256f68aa8421aa0d93a5c9a95018db676a013adefa323fc019a4ccab

See more details on using hashes here.

Provenance

The following attestation bundles were made for retry_cli-0.1.3-py3-none-any.whl:

Publisher: release.yml on geo7/retry-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page