careful-address-89803
08/18/2022, 1:07 AMExportPythonToolSentinel
we could have
Tool = TypeVar("Tool", bound=ExportablePythonTool) # ExportablePythonTool doesn't exist yet
class ExportPythonToolSentinel(Generic(Tool)):
...
@rule
def generic_export(_: ExportPythonToolSentinel[Tool], tool: Tool):
...
I'm not too familiar with the inner working of Python's type hint system and Pant's interaction with it. For example, I don't know if the references to Tool
in the generic_export
have to be the same. It seems kindof related to UnionRule?happy-kitchen-89482
08/20/2022, 2:56 PMhundreds-father-404
08/22/2022, 5:00 PMList[str]
or Optional[str]
. They have to a be a single type()
. That's because the rule graph goes from types to types, and we store the information in Rust of the Python type
careful-address-89803
08/22/2022, 6:02 PM__getitem__
to return unique types.hundreds-father-404
08/22/2022, 8:42 PM