Skip to main content
Version: 2.7 (deprecated)

filter


pants filter [args]

Filter the input targets based on various criteria.

Most of the filtering options below are comma-separated lists of filtering criteria, with an implied logical OR between them, so that a target passes the filter if it matches any of the criteria in the list. A '-' prefix inverts the sense of the entire comma-separated list, so that a target passes the filter only if it matches none of the criteria in the list.

Each of the filtering options may be specified multiple times, with an implied logical AND between them.

Backend: ``

Config section: [filter]

Basic options

address_regex

--filter-address-regex="[[+-]regex1,regex2,..., [+-]regex1,regex2,..., ...]"
PANTS_FILTER_ADDRESS_REGEX
pants.toml
[filter]
address_regex = [
[+-]regex1,regex2,...,
[+-]regex1,regex2,...,
...,
]
default: []

Filter on target addresses matching these regexes.

granularity

--filter-granularity=<TargetGranularity>
PANTS_FILTER_GRANULARITY
pants.toml
[filter]
granularity = <TargetGranularity>
one of: all, file, BUILD
default: all

Filter to rendering only targets declared in BUILD files, only file-level targets, or all targets.

output_file

--filter-output-file=<path>
PANTS_FILTER_OUTPUT_FILE
pants.toml
[filter]
output_file = <path>
default: None

Output the goal's stdout to this file. If unspecified, outputs to stdout.

sep

--filter-sep=<separator>
PANTS_FILTER_SEP
pants.toml
[filter]
sep = <separator>
default: \n

String to use to separate lines in line-oriented output.

tag_regex

--filter-tag-regex="[[+-]regex1,regex2,..., [+-]regex1,regex2,..., ...]"
PANTS_FILTER_TAG_REGEX
pants.toml
[filter]
tag_regex = [
[+-]regex1,regex2,...,
[+-]regex1,regex2,...,
...,
]
default: []

Filter on targets with tags matching these regexes.

target_type

--filter-target-type="[[+-]type1,type2,..., [+-]type1,type2,..., ...]"
PANTS_FILTER_TARGET_TYPE
pants.toml
[filter]
target_type = [
[+-]type1,type2,...,
[+-]type1,type2,...,
...,
]
default: []

Filter on these target types, e.g. resources or python_library.

Advanced options

None

Deprecated options

None

None