black <file or directory...>

Python code formatter

Arguments

NameDescription
file or directoryfilepaths

Options

NameDescription
--code, -c <string>Format the code passed in as a string
--line-length, -l <line length>How many characters per line to allow
--target-version, -t <python version>
  • Repeatable ♾
--pyiFormat all input files regardless of file extension
--ipynbFormat all input files like Jupyter Notebooks regardless of file extension
--python-cell-magics <python-magic>
  • Repeatable ♾
--skip-string-normalization, -SDon't normalize string quotes or prefixes
--skip-magic-trailing-comma, -CDon't use trailing commas as a reason to split lines
--previewEnable potentially disruptive style changes
--checkDon't write the files back, just return the status
--diffDon't write the files back, just output a diff for each file on stdout
--colorShow colored diff
--no-colorShow uncolored diff
--fastSkip temporary sanity checks
--safeRun temporary sanity checks
--required-version <version>Require a specific version of Black
--include <Regex>Regex that matches files and directories that should be included on recursive searches
--exclude <Regex>Regex that matches files and directories that should be excluded on recursive searches
--extend-exclude <Regex>Additional exlusions
--force-exclude <Regex>Exlude matching files and folders even when passed explicitly
--stdin-filename <file>The name of the file when passing it through stdin
--workers, -W <integer>Number of parallel workers
--quiet, -qDon't emit non-error messages to stderr
--verbose, -vAlso emit messages about files that were not changed or were ignored due to exclusion patterns
--versionShow the version
--config <file>Read configuration from filepath
--help, -hShow usage information