skillfed

beautysh

A Bash beautifier for the masses.

beautysh v6.4.3 152.4K downloads/30d#10,901 on PyPI535
Permissive license MIT Active released

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 beautysh

uv

uv add beautysh

poetry

poetry add beautysh

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality AssuranceTopic :: Text Processing :: FiltersTopic :: Utilities

Tags

bash script formattershell script beautifierbash code formattershell indentation toolbash linter beautifyshell script cleanupbash style formatter
bash-formattingcode-qualityshell-scripting

More Python Modules packages