Backends

How to enable specific functionality.

Most Pants functionality is opt-in by adding the relevant backend to the [GLOBAL].backend_packages option in pants.toml. For example:

[GLOBAL]
backend_packages = [
  "pants.backend.shell",
  "pants.backend.python",
  "pants.backend.python.lint.black",
]

Available backends

BackendWhat it doesDocs
pants.backend.awslambda.pythonEnables generating an AWS Lambda zip file from Python code.AWS Lambda
pants.backend.codegen.protobuf.lint.bufActivate the Buf formatter and linter for Protocol Buffers.Protobuf
pants.backend.codegen.protobuf.pythonEnables generating Python from Protocol Buffers. Includes gRPC support.Protobuf and gRPC
pants.backend.codegen.thrift.apache.pythonEnables generating Python from Apache Thrift.Thrift
pants.backend.dockerEnables building, running, and publishing Docker images.Docker overview
pants.backend.docker.lint.hadolintEnables Hadolint, a Docker linter: https://github.com/hadolint/hadolintDocker overview
pants.backend.experimental.codegen.protobuf.goEnables generating Go from Protocol Buffers.
pants.backend.experimental.goEnables Go support.Go overview
pants.backend.experimental.javaEnables core Java support.Java & Scala overview
pants.backend.experimental.java.lint.google_java_formatEnables Google Java Format.Java & Scala overview
pants.backend.experimental.scalaEnables core Scala support.Java & Scala overview
pants.backend.experimental.scala.lint.scalafmtEnables the Scalafmt formatter.Java & Scala overview
pants.backend.experimental.python.lint.autoflakeEnables Autoflake, which removes unused Python imports: https://pypi.org/project/autoflake/Linters and formatters
pants.backend.experimental.python.lint.pyupgradeEnables Pyupgrade, which upgrades to new Python syntax: https://pypi.org/project/pyupgrade/Linters and formatters
pants.backend.experimental.python.packaging.pyoxidizerEnables pyoxidizer_binary target.PyOxidizer
pants.backend.google_cloud_function.pythonEnables generating a Google Cloud Function from Python code.Google Cloud Function
pants.backend.plugin_devoplmentEnables pants_requirements target.Plugins overview
pants.backend.pythonCore Python support.Enabling Python support
pants.backend.python.mixed_interpreter_constraintsAdds the py-constraints goal for insights on Python interpreter constraints.Interpreter compatibility
pants.backend.python.lint.banditEnables Bandit, the Python security linter: https://bandit.readthedocs.io/en/latest/.Linters and formatters
pants.backend.python.lint.blackEnables Black, the Python autoformatter: https://black.readthedocs.io/en/stable/.Linters and formatters
pants.backend.python.lint.docformatterEnables Docformatter, the Python docstring autoformatter: https://github.com/myint/docformatter.Linters and formatters
pants.backend.python.lint.flake8Enables Flake8, the Python linter: https://flake8.pycqa.org/en/latest/.Linters and formatters
pants.backend.python.lint.isortEnables isort, the Python import autoformatter: https://timothycrosley.github.io/isort/.Linters and formatters
pants.backend.python.lint.pylintEnables Pylint, the Python linter: https://www.pylint.orgLinters and formatters
pants.backend.python.lint.yapfEnables Yapf, the Python formatter: https://pypi.org/project/yapf/Linters and formatters
pants.backend.python.typecheck.mypyEnables MyPy, the Python type checker: https://mypy.readthedocs.io/en/stable/.typecheck
pants.backend.shellCore Shell support, including shUnit2 test runner.Shell overview
pants.backend.shell.lint.shfmtEnables shfmt, a Shell autoformatter: https://github.com/mvdan/sh.Shell overview
pants.backend.shell.lint.shellcheckEnables Shellcheck, a Shell linter: https://www.shellcheck.net/.Shell overview

Did this page help you?