wide-midnight-78598
06/11/2024, 2:13 PM06:48:06.66 [ERROR] Completed: Typecheck using MyPy - mypy - mypy failed (exit code 1).
src/python/pants/backend/cc/dependency_inference/rules.py: note: In function "infer_cc_source_dependencies":
src/python/pants/backend/cc/dependency_inference/rules.py:129:13: error: Argument 1 to "determine_explicitly_provided_dependencies" has incompatible type "DependenciesRequest"; expected "ExplicitlyProvidedDependenciesRequest" [arg-type]
DependenciesRequest(request.field_set.dependencies), **implicitly()wide-midnight-78598
06/11/2024, 2:17 PMGet(ExplicitlyProvidedDependencies, DependenciesRequest(request.field_set.dependencies)),
And here's the updated call-by-name:
determine_explicitly_provided_dependencies(
DependenciesRequest(request.field_set.dependencies), **implicitly()
),
Which causes this Typecheck error in rules.py:
Argument of type "DependenciesRequest" cannot be assigned to parameter "request" of type "ExplicitlyProvidedDependenciesRequest"
"DependenciesRequest" is incompatible with "ExplicitlyProvidedDependenciesRequest"PylancereportArgumentTypewide-midnight-78598
06/11/2024, 2:17 PM@rule
async def determine_explicitly_provided_dependencies(
request: ExplicitlyProvidedDependenciesRequest,
union_membership: UnionMembership,
registered_target_types: RegisteredTargetTypes,
subproject_roots: SubprojectRoots,
) -> ExplicitlyProvidedDependencies:
And the Deps vs ExplicitDeps:
@dataclass(frozen=True)
class DependenciesRequest(EngineAwareParameter):
field: Dependencies
should_traverse_deps_predicate: ShouldTraverseDepsPredicate = TraverseIfDependenciesField()
def debug_hint(self) -> str:
return self.field.address.spec
# NB: ExplicitlyProvidedDependenciesRequest does not have a predicate unlike DependenciesRequest.
@dataclass(frozen=True)
class ExplicitlyProvidedDependenciesRequest(EngineAwareParameter):
field: Dependencies
def debug_hint(self) -> str:
return self.field.address.specwide-midnight-78598
06/11/2024, 2:34 PMGet(ExplicitlyProvidedDependencies is the meat of what should be happening, and the rule engine did magic to make this happen DependenciesRequest(request.field_set.dependencies)),
Since converting Dep request to Explicit just abandons the should_traverse paramhappy-kitchen-89482
06/11/2024, 2:48 PMwide-midnight-78598
06/11/2024, 2:49 PMwide-midnight-78598
06/11/2024, 2:57 PM@rule
async def convert_dependencies_request_to_explicitly_provided_dependencies_request(
request: DependenciesRequest,
) -> ExplicitlyProvidedDependenciesRequest:
"""This rule discards any deps predicate from DependenciesRequest.
Calculating ExplicitlyProvidedDependencies does not use any deps traversal predicates as it is
meant to list all explicit deps from the given field. By stripping the predicate from the
request, we ensure that the cache key for ExplicitlyProvidedDependencies calculation does not
include the predicate increasing the cache-hit rate.
"""
# TODO: Maybe require Get(ExplicitlyProvidedDependencies, ExplicitlyProvidedDependenciesRequest)
# and deprecate Get(ExplicitlyProvidedDependencies, DependenciesRequest) via this rule.
return ExplicitlyProvidedDependenciesRequest(request.field)proud-dentist-22844
06/13/2024, 6:02 AMwide-midnight-78598
06/16/2024, 5:38 PMwide-midnight-78598
06/16/2024, 5:43 PMPexProcess -> Process -> magic -> FaillibleProcessResult -> ProcessResultwide-midnight-78598
06/16/2024, 6:07 PMwide-midnight-78598
06/16/2024, 6:13 PMprocess_request_to_process_resultwitty-crayon-22786
06/16/2024, 10:02 PM**implicitly(PexProcess(..))witty-crayon-22786
06/16/2024, 10:03 PMwide-midnight-78598
06/16/2024, 11:49 PMwide-midnight-78598
06/16/2024, 11:53 PMwitty-crayon-22786
06/17/2024, 12:00 AMwide-midnight-78598
06/17/2024, 12:01 AMwide-midnight-78598
06/17/2024, 12:17 AMmypy plugin or something for post-migration would be nice