nitpick package

Main module.

class nitpick.Nitpick[source]

Bases: object

The Nitpick API.

configured_files(*partial_names: str) list[pathlib.Path][source]

List of files configured in the Nitpick style.

Filter only the selected partial names.

echo(message: str)[source]

Echo a message on the terminal, with the relative path at the beginning.

enforce_present_absent(*partial_names: str) Iterator[Fuss][source]

Enforce files that should be present or absent.

Parameters:

partial_names – Names of the files to enforce configs for.

Returns:

Fuss generator.

enforce_style(*partial_names: str, autofix=True) Iterator[Fuss][source]

Read the merged style and enforce the rules in it.

  1. Get all root keys from the merged style (every key is a filename, except “nitpick”).

  2. For each file name, find the plugin(s) that can handle the file.

Parameters:
  • partial_names – Names of the files to enforce configs for.

  • autofix – Flag to modify files, if the plugin supports it (default: True).

Returns:

Fuss generator.

init(project_root: PathOrStr | None = None, offline: bool | None = None) Nitpick[source]

Initialize attributes of the singleton.

project: Project
run(*partial_names: str, autofix=False) Iterator[Fuss][source]

Run Nitpick.

Parameters:
  • partial_names – Names of the files to enforce configs for.

  • autofix – Flag to modify files, if the plugin supports it (default: True).

Returns:

Fuss generator.

classmethod singleton() Nitpick[source]

Return a single instance of the class.

Subpackages

Submodules