*Problem*: - When i use a parametrize'd target, as...
# general
f
Problem: • When i use a parametrize'd target, as a dependency, pants errors. with AmbiquousOwnerError, for one of it, sub-dependencies, however I can built the target all by itself.
Copy code
AmbiguousOwnerError: Found multiple sibling python_distribution targets that are the closest ancestor dependents of lib/mylib:pyproject and are therefore candidates to own it: lib/mylib:mylib_wheel@parametrize=windows-gnu, lib/mylib:mylib_wheel@parametrize=linux. Only a single such owner is allowed, to avoid ambiguity. See <https://www.pantsbuild.org/2.22/docs/python/overview/building-distributions> for how python_sources targets are mapped to distributions. See <https://www.pantsbuild.org/2.22/docs/python/overview/building-distributions>.
Details I have a parametrized
python_distribution
- it's a maturin / rust python wheel. And it builds, no problems.
Copy code
resources(name="rust", sources=["src/**/*.rs", "Cargo.toml"])
resource(name = "pyproject", source = "pyproject.toml")
resource(name = "readme_md", source = "README.md")
resource(name = "version_txt_file", source = "VERSION")


python_distribution(
    name = "mylib_wheel",
    dependencies = [
        ":rust",
        ":pyproject",
        ":version_txt_file",
        ":readme_md",
    ],
    generate_setup = False,
    provides = python_artifact(
        name = "mylib",
        version_file = "VERSION",
        long_description_file = "README.md",
    ),
    wheel_config_settings = {
        "--build-option": [ "--python-tag", "py310.py311" ],
    },
    sdist=False,
    **parametrize("linux", env_vars = ["RUSTUP_HOME", "CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu"]),
    **parametrize("windows-gnu", env_vars = ["RUSTUP_HOME", "CARGO_BUILD_TARGET=x86_64-pc-windows-gnu"]),
)
Copy code
❯ pants package ::
20:34:08.60 [INFO] (pe_nailgun::nailgun_pool) Initializing Nailgun pool for 40 processes...
20:34:11.59 [INFO] (pe_nailgun::nailgun_pool) Initializing Nailgun pool for 40 processes...
20:34:17.71 [INFO] (pants.core.goals.package) Wrote dist/mylib-0.1.0-cp310-abi3-linux_x86_64.whl
20:34:17.71 [INFO] (pants.core.goals.package) Wrote dist/mylib-0.1.0-cp310-abi3-win_amd64.whl
if I list this, I see
Copy code
lib/mylib:gen_changelog
lib/mylib:pyproject
lib/mylib:readme_md
lib/mylib:release
lib/mylib:mylib_wheel@parametrize=linux
lib/mylib:mylib_wheel@parametrize=windows-gnu
...
I have another project in the same repo, that is a docker image, that requires the linux wheel which was generated.. needs that
mylib_wheel
...
Copy code
docker_image(
  name="myapp_thing_docker_image",
  repository="myapp/myapp_thing",
  image_tags=["{build_args.DEFAULT_TAG}"],
  source="Dockerfile",
  dependencies=[
      "//lib/mylib:mylib_wheel@parametrize=linux",
      "./myapp_thing:myapp_thing_wheel",
      "//common/base-containers:images-python@parametrize=py310deb",
  ],
  secrets = {
      "mynetrc": "~/.netrc",
  }
)
There is a few more dependencies there, but in essence, I see this error.
Copy code
AmbiguousOwnerError: Found multiple sibling python_distribution targets that are the closest ancestor dependents of lib/mylib:pyproject and are therefore candidates to own it: lib/mylib:mylib_wheel@parametrize=windows-gnu, lib/mylib:mylib_wheel@parametrize=linux. Only a single such owner is allowed, to avoid ambiguity. See <https://www.pantsbuild.org/2.22/docs/python/overview/building-distributions> for how python_sources targets are mapped to distributions. See <https://www.pantsbuild.org/2.22/docs/python/overview/building-distributions>.
thoughts ?
I recognize the above may be too much information.. but to boil the problem down. We have a set of sources, that are needed in two different wheels, one of these wheels needs to be a "depended-on" library. for a docker image. The build works. but depending upon the wheel .. fails.
For example this works
Copy code
A_py_sources <-- python_distribution1
         `-------python_distribution2
but this does not
Copy code
A_py_sources <-- python_distribution1 <-- docker_image
         `-------python_distribution2
it says
AmbiguousOwnerError
of A_py_sources