--- id: shfmt-py version: "4.0.0" license: MIT license_treatment: permissive maintenance: active --- # shfmt-py — Python wrapper around invoking shfmt (https://github.com/mvdan/sh) License: permissive · Maintenance: active · Downloads: 286.5K/mo ## What it is and what it does shfmt-py is a Python wrapper that downloads and bundles the shfmt shell script formatter binary for your operating system at install time. Once installed, it makes the shfmt command available on your PATH (or as shfmt.exe on Windows), allowing you to format shell scripts from the command line or integrate formatting into your development workflow via pre-commit hooks. The package has no runtime dependencies and is independently versioned from the upstream shfmt project—each release notes specify which shfmt version is bundled. It supports Python 3.9 and later on CPython and PyPy, and provides platform-specific wheels for macOS (Intel and ARM), Linux (x86_64 and aarch64), and Windows. The wrapper handles the complexity of downloading the correct binary for your platform, so you get a consistent shfmt experience across development machines without manual binary management. Use it for: - Enforce consistent shell script formatting in CI/CD pipelines by installing shfmt-py and running it as a linter step. - Set up a pre-commit hook to automatically format shell scripts before commits, using the sample .pre-commit-config.yaml configuration. - Format shell scripts locally during development without manually downloading or managing the shfmt binary for your platform. - Integrate shell script formatting into Python-based build or deployment tools that need to standardize script formatting. - Ensure shell script style consistency across a team by pinning a specific shfmt-py version in a shared development environment. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python-installable wrapper that bundles the shfmt shell script formatter binary for your platform, making it available as a command-line tool or pre-commit hook. Yes, if you need to format shell scripts in a Python environment or CI/CD pipeline. The package is actively maintained, has no runtime dependencies, and provides convenient platform-specific binary distribution. Medium install friction (platform-specific downloads) is a minor trade-off for avoiding manual binary management. Be aware that the bundled shfmt version does not directly mirror the PyPI version—check release notes for the exact upstream version you're getting. ## Install pip install shfmt-py uv add shfmt-py poetry add shfmt-py ## Installing shfmt-py Before you install: Medium install friction due to platform-specific binary downloads at install time. The package is actively maintained with a recent release (93 days ago) and supports current Python versions (3.9+). No runtime dependencies simplifies the installation footprint. License in practice: MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute this package freely as long as you include the license notice. Quickstart: pip install shfmt-py shfmt --version shfmt -i 2 script.sh Requires Python 3.9 or later. Binary downloads occur at install time; SSL certificate issues may occur on macOS and require manual certificate installation. Verify before relying: - Whether the bundled shfmt version is documented clearly enough for users who need a specific upstream shfmt release. - Performance impact of the binary download during installation on slow or unreliable networks. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 286.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags shell script formatter, shfmt wrapper python, format bash scripts, shell code formatter, pre-commit shell formatting, sh script linting, shell script linter, shell-formatting, pre-commit-hook, code-quality [View on SkillFed](https://skillfed.io/packages/shfmt-py) · [View on PyPI](https://pypi.org/project/shfmt-py/)