Skip to main content
Version: 2.0 (deprecated)

filter


pants filter [args]

Filter the input targets based on various criteria.

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.

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

ancestor

--filter-ancestor="[[+-]spec1,spec2,..., [+-]spec1,spec2,..., ...]"
PANTS_FILTER_ANCESTOR
pants.toml
[filter]
ancestor = [
[+-]spec1,spec2,...,
[+-]spec1,spec2,...,
...,
]
default: []
Deprecated, will be removed in version: 2.1.0.dev0.
`--filter-ancestor` was removed because it is not trivial to implement. If you still need this feature, please message us on Slack (https://www.pantsbuild.org/docs/community).

Filter on targets that these targets depend on.

regex

--filter-regex="[[+-]regex1,regex2,..., [+-]regex1,regex2,..., ...]"
PANTS_FILTER_REGEX
pants.toml
[filter]
regex = [
[+-]regex1,regex2,...,
[+-]regex1,regex2,...,
...,
]
default: []
Deprecated, will be removed in version: 2.1.0.dev0.
Use `--address-regex` instead of `--regex`.

Filter on target addresses matching these regexes.

target

--filter-target="[[+-]spec1,spec2,..., [+-]spec1,spec2,..., ...]"
PANTS_FILTER_TARGET
pants.toml
[filter]
target = [
[+-]spec1,spec2,...,
[+-]spec1,spec2,...,
...,
]
default: []
Deprecated, will be removed in version: 2.1.0.dev0.
`--filter-target` was removed because it is similar to `--filter-address-regex`. If you still need this feature, please message us on Slack (https://www.pantsbuild.org/docs/community).

Filter on these target addresses.

type

--filter-type="[[+-]type1,type2,..., [+-]type1,type2,..., ...]"
PANTS_FILTER_TYPE
pants.toml
[filter]
type = [
[+-]type1,type2,...,
[+-]type1,type2,...,
...,
]
default: []
Deprecated, will be removed in version: 2.1.0.dev0.
Use `--target-type` instead of `--type`.

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

None