black <command...>

Python code formatter

Arguments

NameDescription
commandfilepaths

Options

NameDescription
--code,-c <command>Format the code passed in as a string
--line-length,-l <command>How many characters per line to allow
--target-version,-t <command>
  • Repeatable ♾
--pyiFormat all input files regardless of file extension
--ipynbFormat all input files like Jupyter Notebooks regardless of file extension
--python-cell-magics <command>
  • 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 <command>Require a specific version of Black
--include <command>Regex that matches files and directories that should be included on recursive searches
--exclude <command>Regex that matches files and directories that should be excluded on recursive searches
--extend-exclude <command>Additional exlusions
--force-exclude <command>Exlude matching files and folders even when passed explicitly
--stdin-filename <command>The name of the file when passing it through stdin
--workers,-W <command>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 <command>Read configuration from filepath
--help,-hShow usage information