Code style

pre-commit performs automatic formatting and linting of the code.

Lint with pre-commit

Alternatively, use pre-commit to perform the same job. pre-commit hooks need to be installed:

pre-commit install

Now, each use of git commit in the shell will trigger actions defined in the .pre-commit-config.yaml file. pre-commit is easily deactivated with a similar command:

pre-commit uninstall

If you wish to run pre-commit asynchronously, use:

pre-commit run --all-files

Note

pre-commit by default also runs ruff and codespell sessions.

Tools

Tools used in the Topwrap project for maintaining the code style:

  • pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.

  • ruff is a Python linter and code formatter.

  • codespell is a Python tool to fix common spelling mistakes in text files


Last update: 2026-07-13