pants
scalable build system for monorepos
TLDR
SYNOPSIS
pants [options] goal [targets...]
DESCRIPTION
pants is a scalable build system for monorepos. It supports Python, Go, Java, Scala, Shell, and Docker.Target notation uses colons to separate path and target name. Double colons (::) match all targets recursively.Caching and memoization make repeated builds fast. Remote caching enables team-wide build sharing.Dependency inference automatically discovers imports. Explicit dependencies can be declared in BUILD files.Fine-grained invalidation rebuilds only affected targets. Concurrent execution uses available cores.
PARAMETERS
list
List matching targets.test
Run tests for matching test targets.fmt
Format source files in-place using configured formatters.lint
Run lint checks on matching targets.check
Run type/compilation checks (e.g. mypy, javac).package
Build deployable artifacts (wheels, pex, jars, docker images).run
Run an executable target.publish
Publish deployable artifacts to a remote registry.dependencies
Show the transitive dependencies of a target.dependents
Show targets that depend on the given target.roots
List all root targets that match.peek
Print detailed metadata about matching targets.repl
Start an interactive REPL preloaded with the specified targets.tailor
Auto-generate or update BUILD files.update-build-files
Apply deprecation fixes to existing BUILD files.--changed-since REF
Limit targets to those changed since the given git ref.--changed-dependents=MODE
Include dependents of changed targets (none, direct, transitive).-l, --level LEVEL
Log level (trace, debug, info, warn, error).--keep-sandboxes=MODE
Keep the execution sandbox for debugging (always, onfailure, never_).--no-local-cache, --no-remote-cache
Disable the local or remote build cache for the run.
CAVEATS
Requires BUILD files defining targets. Initial setup has learning curve. Large codebase initial run can be slow.
HISTORY
Pants was originally developed at Twitter around 2011. Version 2.x was a ground-up rewrite focusing on Python ergonomics. Now maintained by Toolchain as an open-source project.