Python

Configuration - Analysis

This section covers configuration specific to python analyzer. Please make sure to read the general configuration guide first.

name

  • Type: String
  • Presence: mandatory
  • Description: Shortcode of the analyzer.
  • Example:
name = "python"

enabled

  • Type: Boolean
  • Presence: mandatory
  • Description: Toggle whether this analyzer should be run.
  • Example:
enabled = true

runtime_version

  • Type: String
  • Presence: optional
  • Description: Runtime version in semver. Available values for python analyzer are "2.x.x" and "3.x.x". Defaults to "3.x.x"
  • Example:
runtime_version = "3.x.x"

dependency_file_paths

  • Type: Array
  • Presence: optional
  • Description: List of files that contain the list of external dependencies.
  • Example:
dependency_file_paths = [
  "dev_requirements.txt",
  "prod_requirements.txt"
]

TIP

By default requirements.txt, Pipfile, Pipfile.lock and setup.py are automatically detected and scanned for dependencies if found in the repository's root.

meta

  • Type: Table
  • Presense: optional
  • Description: Any supported metadata to pass to the analyzer.
  • Example:
[analyzers.meta]
  "max_line_length" = 88
  "skip_doc_coverage" = ["module", "magic", "init"]
max_line_length
  • Type: Integer
  • Presence: optional
  • Description: Maximum allowed line length (including documentation). Defaults to 88. Minimum value should be greater than or equal to 79.
  • Example:
max_line_length = 88
skip_doc_coverage
  • Type: Array

  • Presence: mandatory

  • Description: Specify which artifacts to skip when calculating documentation coverage. Available values are module, magic, init and class. By default module, magic and init are skipped.

    • module - Ignore module docstrings
    • magic - Ignore docstrings of magic methods (except "init")
    • init - Ignore docstrings of "init" methods
    • class - Ignore docstrings of class definitions
  • Example:

skip_doc_coverage = ["module", "magic", "init"]

Example

version = 1

test_patterns = [
  "tests/",
  "test_*.py"
]

[[analyzers]]
name = "python"
enabled = true
runtime_version = "3.x.x"
dependency_file_paths = ["requirements/development.txt"]

  [analyzers.meta]
  max_line_length = 88
  skip_doc_coverage = ["module", "magic", "init"]