cool-easter-32542
09/09/2023, 4:15 PMlib/core
service/service1
service/service2
pants.toml
I want to have a separate "resolve" for each service. For this I parametrize lib/core, I populate python_sources and python_requirements with "resolve" argument. Then I had to workaround parametrization of the distribution like this:
python_sources(
name="egg",
sources=["cave_core/**/*.py"],
resolve=parametrize(*all_resolves()),
)
python_requirements(name="reqs", source="pyproject.toml", resolve=parametrize(*all_resolves()))
for resolve in all_resolves():
python_distribution(
name=f"whl_{resolve}",
output_path=f"{resolve}/",
dependencies=[f":reqs@resolve={resolve}", f":egg@resolve={resolve}"],
provides=python_artifact(name="cave-core", version="9999"),
generate_setup=True,
)
I create a new distribution name for each resolve, then I use different name of the distribution for each service.
Describe the solution you'd like
I thought, maybe it could be possible to transform it into this:
python_distribution(
name="whl",
resolve=parametrize(*all_resolves()),
dependencies=[f":reqs", f":egg"],
provides=python_artifact(name="cave-core", version="9999"),
generate_setup=True,
)
• output_dir could be inferred from "resolve"
• parametrized dependencies automatically inherit resolve if they require it
• name is not modified, but parametrized
Describe alternatives you've considered
I mentioned my workaround, but I find it a bit unnaturally fitting into pants system. renaming packages instead of using "parametrize" rings a bell.
Thanks!
pantsbuild/pants