<#19812 parametrized python_distribution resolves>...
# github-notifications
c
#19812 parametrized python_distribution resolves Issue created by vindex10 Is your feature request related to a problem? Please describe. Hi! I'm new to pants, but already set up some working configuration for my case. Thank you for so nicely written documentation :) My setup is a core library and several services using it:
Copy code
lib/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:
Copy code
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:
Copy code
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