id = "black" name = "Black" homepage = "https://black.readthedocs.io" description = "The uncompromising Python code formatter." icon = "SimpleIcons:black" executables = ["black", "blackd"] [dotfiles] # https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html # names the "global" configuration: $XDG_CONFIG_HOME/black (~/.config/black when # unset) on Unix-like systems, ~\.black on Windows. src/black/files.py # (find_user_pyproject_toml) is the same two branches. Both are TOML files read # through parse_pyproject_toml, so their contents live under [tool.black]. paths = [ "~/.config/black", "~/.black", ] # src/black/cache.py: platformdirs.user_cache_dir("black"), i.e. ~/.cache/black # on Linux and ~/Library/Caches/black on macOS — the cache home under both # names, so [cacheHome] — holding pickled formatting results per Black version. exclude = ["[cacheHome]/black/"] # Formatting options only. Black has no credentials. secret = [] # Read once per run; the file is never written back. side_effect = false # No machine_lines: line length, target versions and exclude patterns are # exactly the preferences a user wants to follow them between machines. [commands] format = 1 label = "Format Python code" description = "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." quality = "ai-draft" base = "fig:black" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/black.ts" license = "MIT" [[commands.field]] id = "files" label = "Files or directories" description = "Leave blank only when using Code below." type = "path" position = 0 multiple = true path = { kind = "any", role = "input" } sources = ["fig"] [[commands.field]] id = "code" label = "Code string" description = "Format this code instead of files." type = "string" option = ["--code", "-c"] sources = ["fig"] [[commands.field]] id = "line_length" label = "Line length" description = "Characters per line." type = "integer" option = ["--line-length", "-l"] sources = ["fig"] [[commands.field]] id = "target_version" label = "Target versions" description = "Python versions that must be supported." type = "string" option = ["--target-version", "-t"] multiple = true suggestions = [{ value = "py37", label = "py37" }, { value = "py38", label = "py38" }, { value = "py39", label = "py39" }, { value = "py310", label = "py310" }] sources = ["fig"] [[commands.field]] id = "check" label = "Check only" description = "Do not write files; exit status reports whether changes are needed." type = "boolean" option = ["--check"] sources = ["fig"] [[commands.field]] id = "diff" label = "Show diff only" description = "Do not write files; print a diff." type = "boolean" option = ["--diff"] sources = ["fig"] [[commands.field]] id = "skip_string_normalization" label = "Keep string quotes" type = "boolean" option = ["--skip-string-normalization", "-S"] sources = ["fig"] [[commands.field]] id = "skip_magic_trailing_comma" label = "Ignore magic trailing comma" type = "boolean" option = ["--skip-magic-trailing-comma", "-C"] sources = ["fig"] [[commands.field]] id = "preview" label = "Preview style" description = "Enable potentially disruptive style changes." type = "boolean" option = ["--preview"] sources = ["fig"] [[commands.field]] id = "pyi" label = "Treat as stubs (.pyi)" type = "boolean" option = ["--pyi"] sources = ["fig"] [[commands.field]] id = "ipynb" label = "Treat as notebooks" type = "boolean" option = ["--ipynb"] sources = ["fig"] [[commands.field]] id = "include" label = "Include regex" type = "string" option = ["--include"] sources = ["fig"] [[commands.field]] id = "exclude" label = "Exclude regex" type = "string" option = ["--exclude"] sources = ["fig"] [[commands.field]] id = "extend_exclude" label = "Extra exclude regex" type = "string" option = ["--extend-exclude"] sources = ["fig"] [[commands.field]] id = "force_exclude" label = "Force-exclude regex" description = "Exclude even when passed explicitly." type = "string" option = ["--force-exclude"] sources = ["fig"] [[commands.field]] id = "config" label = "Config file" type = "path" option = ["--config"] path = { kind = "file", role = "input" } sources = ["fig"] [[commands.field]] id = "stdin_filename" label = "Name for stdin" type = "string" option = ["--stdin-filename"] sources = ["fig"] [[commands.field]] id = "workers" label = "Parallel workers" type = "integer" option = ["--workers", "-W"] sources = ["fig"] [[commands.field]] id = "quiet" label = "Quiet" type = "boolean" option = ["--quiet", "-q"] sources = ["fig"] [[commands.field]] id = "verbose" label = "Verbose" type = "boolean" option = ["--verbose", "-v"] sources = ["fig"] [[commands.task]] id = "format" label = "Format in place" fields = ["files", "line_length", "target_version", "preview"] required = ["files"] [[commands.task]] id = "check" label = "Check only" fields = ["files", "line_length", "check", "diff"] required = ["files"] set = { check = [true] } [[commands.task]] id = "diff" label = "Preview changes as diff" fields = ["files", "diff"] required = ["files"] set = { diff = [true] } [[commands.group]] id = "basic" label = "Basic" fields = ["files", "line_length", "target_version", "check", "diff", "skip_string_normalization", "preview"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["code", "skip_magic_trailing_comma", "pyi", "ipynb", "include", "exclude", "extend_exclude", "force_exclude", "config", "stdin_filename", "workers", "quiet", "verbose"]