YAPF

A formatter for Python files.

Version

0.25.0

Runtime

Python Versions

Supported Languages

Python

Official Documentation

https://github.com/google/yapf

YAML Configuration

yapf:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    true/false

    Specifying true implies --in-place option.

  • config-file:

    Alias of --style option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

  • options:

    Below is the list of options that are supported:

    -e PATTERN, --exclude PATTERN
                          patterns for files to exclude from formatting
    --style STYLE         specify formatting style: either a style name (for
                          example "pep8" or "google"), or the name of a file
                          with style settings. The default is pep8 unless a
                          .style.yapf or setup.cfg file located in the same
                          directory as the source or one of its parent
                          directories (for stdin, the current directory is
                          used).
    --no-local-style      don't search for local style definition
    
  • thresholds:

  • experimental:

    • incremental:

      true/false

      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Style files:
        • Files specified in config-file field
        • Files specified to --style option
        • If none of the above configuration files are found:
          • .style.yapf, setup.cfg at the repository root

YAML Examples

  • With default options:

    inspecode:
      yapf: default
    
  • With enabling auto-fixing and default options:

    inspecode:
      yapf: auto-fix
    
  • With custom machine:

    inspecode:
      yapf:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
    
  • With custom options:

    inspecode:
      yapf:
        options:
          --no-local-style:
    
  • With a configuration file:

    inspecode:
      yapf:
        config-file: google
    

    The above configuration is equivalent to:

    inspecode:
      yapf:
        options:
          --style: google
    

    google is a built-in configuration, however, you can of course specify your own configuration file if you have.

results matching ""

    No results matching ""