When a user resolve shadows a tool resolve, pants generate-lockfiles will generate the lockfile twice.
This is because only the --request arg is deduplicated. Without one specified, all known resolves are added to a non-deduplicated collection. The resolves are added separately for each backend and ExportableTool. This can introduce duplicates into this list. And, although the shadowing is correct, the resolve is exported twice. For example, the tool Black and a user resolve named "black" will both use the same resolve name, resulting in a list of resolves to export like RequestedPythonUserResolveNames(['black', 'python-default', 'coverage-py', 'pytest', 'ipython', 'black']).
This MR makes 3 adjustments to this process:
RequestedUserResolveNames is now a DeduplicatedCollection. This mitigates the most proximate issue of specifying the same resolve.
Python deduplicates GeneratePythonLockfile. This may already be covered by 1, but can't hurt
Python does not present tool resolves for tools that are using a user resolve. For example, if [black].install_from_resolve="linters", its default resolve "black" will not be exposed.
Note that in the case of shadowing without install_from_resolve, although the shadowed resolve is not surfaced (for export), Pants will still correctly use the default lockfile.
When a user resolve shadows a tool resolve,
pants generate-lockfiles
will generate the lockfile twice. This is because only the--request
arg is deduplicated. Without one specified, all known resolves are added to a non-deduplicated collection. The resolves are added separately for each backend andExportableTool
. This can introduce duplicates into this list. And, although the shadowing is correct, the resolve is exported twice. For example, the tool Black and a user resolve named "black" will both use the same resolve name, resulting in a list of resolves to export likeRequestedPythonUserResolveNames(['black', 'python-default', 'coverage-py', 'pytest', 'ipython', 'black'])
.This MR makes 3 adjustments to this process:
RequestedUserResolveNames
is now aDeduplicatedCollection
. This mitigates the most proximate issue of specifying the same resolve.GeneratePythonLockfile
. This may already be covered by 1, but can't hurt[black].install_from_resolve="linters"
, its default resolve "black" will not be exposed.Note that in the case of shadowing without
install_from_resolve
, although the shadowed resolve is not surfaced (for export), Pants will still correctly use the default lockfile.closes #21625