All apps/Black

Black

black

The uncompromising Python code formatter.

Runs as black, blackd|macOS, Linux, Windows|black.readthedocs.io

Command form

ai-draft · 3 tasks · 20 fields

Format Python files or directories in place, or check and diff them. Config discovery is left to Black; color, safe/fast and notebook-magic options are left out.

Opens the form; the finished command lands at your prompt, unrun
otty gui black
Format Python codeExample values, fixed in this page — nothing here reaches a terminal
Basic
Files or directories*
any
Line length
integer
Target versions
string
Preview style
--preview
TasksEach one presets the form for one job
Format in place
filesline_lengthtarget_versionpreview
Check only
filesline_lengthcheckdiff
Preview changes as diff
filesdiff
ParametersOnly these flags are editable in the form
Files or directories
Leave blank only when using Code below.
path · positional 0 · repeatable
Code string
Format this code instead of files.
string
--code-c
Line length
Characters per line.
integer
--line-length-l
Target versions
Python versions that must be supported.
string · repeatable
--target-version-tpy37py38py39py310
Check only
Do not write files; exit status reports whether changes are needed.
boolean
--check
Show diff only
Do not write files; print a diff.
boolean
--diff
Keep string quotes
boolean
--skip-string-normalization-S
Ignore magic trailing comma
boolean
--skip-magic-trailing-comma-C
Preview style
Enable potentially disruptive style changes.
boolean
--preview
Treat as stubs (.pyi)
boolean
--pyi
Treat as notebooks
boolean
--ipynb
Include regex
string
--include
Exclude regex
string
--exclude
Extra exclude regex
string
--extend-exclude
Force-exclude regex
Exclude even when passed explicitly.
string
--force-exclude
Config file
path
--config
Name for stdin
string
--stdin-filename
Parallel workers
integer
--workers-W
Quiet
boolean
--quiet-q
Verbose
boolean
--verbose-v
SourcesEvery flag above is checked against these
fig
completion

github.com

Before it fills your prompt, Otty checks the installed black against its version. A form that does not match your version is not offered.