Programming Language
- Python :: 3
- Python :: 3 :: Only
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
shfmt-py
Python-installable wrapper for shfmt, the shell script formatter.
Internally this package downloads the pre-built shfmt binary for your platform at install time.
Modeled after shellcheck-py, adapted for shfmt.
Installation
pip install shfmt-py
Usage
CLI
After installation, the shfmt binary is available on your PATH (or shfmt.exe on Windows).
As pre-commit hook
See pre-commit for instructions.
Sample .pre-commit-config.yaml:
- repo: https://github.com/maxwinterstein/shfmt-py
rev: v3.13.0.3
hooks:
- id: shfmt
Versioning
shfmt-py is independently versioned. The PyPI version does not directly
mirror the bundled shfmt version — check each GitHub release's notes for the
exact shfmt version that release bundles.
- Major — breaking change to
shfmt-pyitself (e.g. dropping a Python version, renaming the pre-commit hook id). - Minor — new upstream
shfmtrelease bundled. - Patch — wrapper-only fix (hash regeneration, CI changes affecting users, etc.).
Releases 3.x.y.z and earlier used a 4-segment scheme aligned with upstream
shfmt. From v4.0.0 onwards shfmt-py follows standard semver.
FAQ
Q: It won't get updated via e.g. Renovate Bot
A: Releases v4.0.0 and onwards use standard semver — no special Renovate
config needed. For older 3.x.y.z releases you'll need
"versioning": "pep440" (or see https://github.com/shfmt-py/update-via-renovate).
Q: I get something like SSL: CERTIFICATE_VERIFY_FAILED on macOS
A: Install certificates with e.g.: "/Applications/Python 3.9/Install Certificates.command". See here or here for a solution.
Wheel compatibility matrix
| Platform | Python 2 | Python 3 |
|---|---|---|
| macosx_10_9_x86_64 | ||
| macosx_11_0_arm64 | ||
| manylinux2014_aarch64 | ||
| manylinux2014_x86_64 | ||
| win_amd64 |