Enabling backends
How to enable new functionality, like Python support.
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:
<<pantscmd>> cloc 'src/**'
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_packages2
config key in pants.toml
.
For example, to enable Python support:
[GLOBAL]
...
backend_packages2 = ['pants.backend.python']
Plugins
Pants ships with several useful backends built in. Others are provided via plugins. A Pants plugin is a Python distribution containing one or more Pants backends.
You install a plugin by listing it under the plugins2
config key in pants.toml
:
[GLOBAL]
...
plugins2 = ['foo.bar==3.12.0']
Note that a plugin may auto-register some or all of its backends. If it does not, you will need to list them under backend_packages2
. The documentation for the plugin you're installing will have the details.
Updated over 3 years ago