HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.13, which is no longer officially supported. Click here for the latest version, 2.18!
./pants fmt [args]

Autoformat source code.

Backend: pants.core
Config section: [fmt]

Basic options

only

--fmt-only="['<str>', '<str>', ...]"

PANTS_FMT_ONLY

default: []

Only run these formatters and skip all others.

The formatter names are outputted at the final summary of running this goal, e.g. isort and shfmt. You can also run fmt --only=fake to get a list of all activated formatters.

You can repeat this option, e.g. fmt --only=isort --only=shfmt or fmt --only=['isort', 'shfmt'].


Advanced options

batch_size

--fmt-batch-size=<int>

PANTS_FMT_BATCH_SIZE

default: 128

The target number of files to be included in each formatter batch.

Formatter processes are batched for a few reasons:

  1. to avoid OS argument length limits (in processes which don't support argument files)
  2. to support more stable cache keys than would be possible if all files were operated on in a single batch.
  3. to allow for parallelism in formatter processes which don't have internal parallelism, or -- if they do support internal parallelism -- to improve scheduling behavior when multiple processes are competing for cores and so internal parallelism cannot be used perfectly.

In order to improve cache hit rates (see 2.), batches are created at stable boundaries, and so this value is only a "target" batch size (rather than an exact value).


Deprecated options

None

Related subsystems

filter