gifted-refrigerator-82216
01/08/2025, 10:32 AMBUILD
I declare:
_resolves = ("default", "special")
__defaults__(all=dict(resolve=parametrize(*_resolves)))
And the entry_points
looks like this:
entry_points={
"console_scripts": { "my-cmd": "my-pkg.my-cmd:main" },
}
I want this entry point to be installed no matter what lockfile is used. The entry point shouldn't care about the lockfile and just point to my-pkg.my-cmd:main
.
However, pants gives me this warning:
[WARN] The python_distribution target packages/my-pkg:my-pkg has the field
`entry_points={'console_scripts': {'my-cmd': 'my-pkg.my-cmd:main'}}`,
which maps to the Python module `my-pkg.my-cmd`,
but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use:
['packages/my-pkg/my-cmd.py@resolve=default',
'packages/my-pkg/my-cmd.py@resolve=special'].
Please explicitly include the dependency you want in the `dependencies` field of packages/my-pkg:my-pkg, or ignore the ones you do not want by prefixing with `!` or `!!` so that one or no targets are left.
Alternatively, you can remove the ambiguity by deleting/changing some of the targets so that only 1 target owns this module. Refer to <https://www.pantsbuild.org/2.20/docs/using-pants/troubleshooting-common-issues#import-errors-and-missing-dependencies>.
Do you have any advice how to resolve the warning? Because when the package is installed, the entry point is installed as intended.
Thank you!gifted-lunch-20593
01/08/2025, 1:11 PMdazzling-pizza-75442
01/08/2025, 4:12 PM__defaults__
exactly the way you are: https://pantsbuild.slack.com/archives/C046T6T9U/p1734029106164119?thread_ts=1734025088.027889&cid=C046T6T9U