beautysh
A Bash beautifier for the masses.
What it is and what it does
Beautysh is a command-line tool and Python library that reformats Bash shell scripts to a consistent style. It parses Bash syntax—including ambiguous constructs like keywords used as variable names—and applies indentation, function formatting, and variable style transformations. The tool runs as a standalone CLI that beautifies files in place or checks them without modification, and can also be imported as a Python module for programmatic use.
The package handles real-world Bash complexity: here-docs are preserved unchanged to respect original formatting intent, special comments like `@formatter:off` allow selective disabling of formatting, and configuration can come from command-line flags, pyproject.toml, or .editorconfig files. It depends on colorama for colored output, editorconfig for configuration file support, and tomli for TOML parsing.
Use it for:
- Enforce consistent indentation and style across a large codebase of shell scripts in CI/CD pipelines.
- Reformat inherited or legacy Bash scripts to match a team's coding standards before maintenance work.
- Integrate into pre-commit hooks or editor plugins to auto-beautify shell scripts on save.
- Batch-process shell scripts in a repository or system directory to standardize formatting.
- Programmatically format Bash code within a Python application or build tool.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Beautysh automatically formats and beautifies Bash shell scripts with configurable indentation, function styles, and variable formatting, handling complex Bash syntax including here-docs and special cases.
Yes. Beautysh is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem—Bash formatting is genuinely difficult due to the language's ambiguous syntax. Use it if you need to standardize shell script formatting across a team or codebase. The ~99% error-free rate on large system scripts suggests it handles real-world cases well, though edge cases may exist.
Install
beautysh on PyPI
pip
pip install beautyshuv
uv add beautyshpoetry
poetry add beautyshInstalling beautysh
Before you install
Low friction: pure Python wheel with only three lightweight runtime dependencies (colorama, editorconfig, tomli). Active maintenance with recent commits and no known vulnerabilities.
License in practice
MIT license is permissive; you can use, modify, and distribute beautysh freely in commercial and private projects with minimal restrictions.
Quickstart
pip install beautysh
beautysh file1.sh file2.sh
# Or as a module:
from beautysh import BashFormatter
formatter = BashFormatter(indent_size=4)
result, error = formatter.beautify_string("echo hello")
Requires Python 3.9 or later.
Verify before relying
- Whether the ~99% error-free rate mentioned in the description applies to current version 6.4.3 or is historical.
- Performance characteristics when processing very large Bash scripts or batch operations.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — colorama, editorconfig, tomli |
| Maintenance | actively maintained — 155 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 152,421/month — #10,901 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: beautysh-6.4.3-py3-none-any.whl
Keywords: auto, bash, beautifier, beautify, script, shell
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
config-formatterAutomatically formats .ini and .cfg…
permissive · top 15,000 on PyPI
yamlfixyamlfix is a command-line YAML formatter that…
copyleft · top 5,000 on PyPI
cssbeautifierBeautifies, unpacks, and deobfuscates CSS code…
permissive · top 5,000 on PyPI
jsbeautifierBeautifies, unpacks, and deobfuscates…
permissive · top 5,000 on PyPI
reformat-gherkinAutomatically formats Gherkin feature files to…
permissive · top 15,000 on PyPI
EditorConfigParses and applies EditorConfig files to…
permissive · top 5,000 on PyPI
djlintdjlint formats and lints HTML templates with…
copyleft · top 5,000 on PyPI
sql-formatterReformats SQL queries into standardized,…
permissive · top 5,000 on PyPI
yapfYAPF automatically reformats Python code to…
permissive · top 5,000 on PyPI
add-trailing-commaAutomatically adds trailing commas to…
permissive · top 15,000 on PyPI