A Python wrapper around shfmt, the shell script formatter. Downloads and manages the shfmt binary automatically. Current version 3.12.0.2, wraps mvdan/sh v3.12.0. Supports Python >=3.9. Releases follow upstream shfmt versions with a patch suffix.
pip install shfmt-pyVerified import paths — ran on the pinned version, not inferred.
Basic usage: call shfmt() with code string and optional arguments. Use write=True to overwrite file. Use filename= to pass filename for error detection context.
Set environment variable SHPATH to a pre-downloaded binary path, or use the binary caching mechanism (see docs).
Always provide a filename (e.g., 'script.sh') when calling shfmt() to ensure correct language detection.
Check upstream shfmt release notes for breaking changes. The fourth number is the wrapper patch.
No dependency data recorded yet.