Skip to content

bunpy fmt

bunpy fmt [flags] [path...]

Description

Formats Python source files in place. Without a path argument, formats all .py files reachable from the current directory. The formatter follows PEP 8 with a configurable line length.

Flags

FlagDefaultDescription
--checkoffExit non-zero if any file would be reformatted (CI mode)
--line-length <n>88Maximum line length
--diffoffPrint unified diff instead of writing files
--help, -hPrint help

Examples

Format all files in the current directory:

bunpy fmt

Format a specific file or directory:

bunpy fmt src/
bunpy fmt src/myapp/main.py

CI check - fails if formatting would change any file:

bunpy fmt --check

Print diff without writing:

bunpy fmt --diff src/