Skip to main content
Version: 2.0 (deprecated)

source


Configuration for roots of source trees.

Backend: ``

Config section: [source]

Basic options

None

Advanced options

marker_filenames

--source-marker-filenames="[filename, filename, ...]"
PANTS_SOURCE_MARKER_FILENAMES
pants.toml
[source]
marker_filenames = [
filename,
filename,
...,
]
default: []

The presence of a file of this name in a directory indicates that the directory is a source root. The content of the file doesn't matter, and may be empty. Useful when you can't or don't wish to centrally enumerate source roots via root_patterns.

root_patterns

--source-root-patterns="[["pattern1", "pattern2", ...], ["pattern1", "pattern2", ...], ...]"
PANTS_SOURCE_ROOT_PATTERNS
pants.toml
[source]
root_patterns = [
["pattern1",
"pattern2",
...],
["pattern1",
"pattern2",
...],
...,
]
default:
[
  "/",
  "src",
  "src/python",
  "src/py"
]

A list of source root suffixes. A directory with this suffix will be considered a potential source root. E.g., src/python will match <buildroot>/src/python, <buildroot>/project1/src/python etc. Prepend a / to anchor the match at the buildroot. E.g., /src/python will match <buildroot>/src/python but not <buildroot>/project1/src/python. A * wildcard will match a single path segment, e.g., src/* will match <buildroot>/src/python and <buildroot>/src/rust. Use / to signify that the buildroot itself is a source root. See https://www.pantsbuild.org/docs/source-roots.

Deprecated options

unmatched

--source-unmatched=<str>
PANTS_SOURCE_UNMATCHED
pants.toml
[source]
unmatched = <str>
one of: create, fail
default: create

Deprecated, will be removed in version: 2.1.0.dev0.
The option `--source-unmatched` does not do anything. Pants will always fail if the source root does not exist.

Configures the behavior when sources are defined outside of any configured source root. create will cause a source root to be implicitly created at the definition location of the sources; fail will trigger an error.

None