Pants has some basic, non-language-specific functionality built in to its core. For example, you can count the lines of code under some directory in your repo:
$ ./pants count-loc 'src/**'
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
Python 13 155 50 22 83 5
BASH 2 261 29 22 210 10
JSON 2 25 0 0 25 0
...
However most Pants functionality, including all language-specific functionality, is provided via backends.
A backend is a Python package that implements some required functionality, and uses hooks to register itself with Pants. You enable a backend by listing it under the backend_packages
config key in pants.toml
.
For example, to enable Python support:
[GLOBAL]
backend_packages = ["pants.backend.python"]
Available backends
Activate by adding the backend to the option backend_packages
in the [GLOBAL]
scope in pants.toml
.
Backend | What it does | Docs |
---|---|---|
| Enables generating an AWS Lambda zip file from Python code. | |
| Enables generating Python from Protocol Buffers. Includes gRPC support. | |
| Core Python support. | |
| Adds the | |
| Enables Bandit, the Python security linter: https://bandit.readthedocs.io/en/latest/. | |
| Enables Black, the Python autoformatter: https://black.readthedocs.io/en/stable/. | |
| Enables Docformatter, the Python docstring autoformatter: https://github.com/myint/docformatter. | |
| Enables Flake8, the Python linter: https://flake8.pycqa.org/en/latest/. | |
| Enables isort, the Python import autoformatter: https://timothycrosley.github.io/isort/. | |
| Enables Pylint, the Python linter: https://www.pylint.org. | |
| Enables MyPy, the Python type checker: https://mypy.readthedocs.io/en/stable/. |
Updated 2 months ago