brainy-airline-59624
10/01/2025, 8:20 AMbrainy-airline-59624
10/01/2025, 8:21 AMelegant-florist-94385
10/01/2025, 9:48 AMprotobuf_sources(
sources=["path/to/submodule/**/*.proto"]
)
You can then use overrides (or separate protobuf_sources target generators with more specific sources globs) if you need to customize any metadata.
This ought to make it work fairly smoothly within your monorepo, despite not being instrumented with pants tooling natively.elegant-florist-94385
10/01/2025, 9:52 AMelegant-florist-94385
10/01/2025, 9:57 AMbrainy-airline-59624
10/01/2025, 10:18 AMbrainy-airline-59624
10/01/2025, 10:21 AMelegant-florist-94385
10/01/2025, 10:30 AMpython_requirements(
source="requirements.base.txt",
resolve=parametrize("projectA", "projectB"),
)
python_requirement(
requirements=["Django==3.2.8"],
resolve="projectA",
)
python_requirement(
requirements=["Django==4.2.24"],
resolve="projectB",
)
(Not shown: pants.toml is the place to declare the resolve itself)
Then for any (1st party) code specific to project A or B:
python_sources(
resolve="projectA"
)
but any code that is shared library kind of stuff that must work with both A and B:
python_sources(
resolve=parametrize("projectA", "projectB")
)
which will behind the scenes create two python_source targets for each file, (one for each resolve). Ultimately this means that this file will get linted twice, mypy checked twice, and even have its unit tests run twice, to ensure that it works in both resolves that it claims to be compatible withhappy-kitchen-89482
10/01/2025, 9:49 PMhappy-kitchen-89482
10/01/2025, 9:50 PMhappy-kitchen-89482
10/01/2025, 9:51 PMhappy-kitchen-89482
10/01/2025, 9:51 PMhappy-kitchen-89482
10/01/2025, 9:53 PMbrainy-airline-59624
10/02/2025, 12:46 AMhappy-kitchen-89482
10/03/2025, 5:17 PMhappy-kitchen-89482
10/03/2025, 5:18 PMbrainy-airline-59624
10/06/2025, 2:26 AM