GitHub logo
279 stars, 18 forks


You can configure Ward using the standard pyproject.toml configuration file, defined in PEP 518.

You don't need a pyproject.toml file to use Ward.

Ward will read your pyproject.toml file and treat the values inside it as defaults.

If you pass an option via the command line that also appears in your pyproject.toml, the option supplied via the command line takes priority.

Where Ward looks for pyproject.toml

In summary, the process it uses is:

  • Find the common base directory of all files passed in via the --path option (default to the current working directory).
  • Starting from this directory, look at all parent directories, and return the file if it is found.
  • If a directory contains a .git directory/file, a .hg directory, or the pyproject.toml file, stop searching.

This is the same process Black (the popular code formatting tool) uses to discover the file.

Example pyproject.toml

The pyproject.toml file contains different sections for different tools. Ward uses the [tool.ward] section.

path = ["unit_tests", "integration_tests"] # supply multiple paths using a list
capture-output = false # enable or disable output capturing (e.g. to use debugger)
order = "standard" # or 'random'
output-mode = "test-per-line" # or 'dots-global', 'dot-module'
fail-limit = 20 # stop the run if 20 fails occur
search = "my_function" # search in test body or description