Currently, generics are not well supported in XPM, which prevents some basic type checking before running tasks – and this in turn can lead to errors that will only be detected when running the task. There are two things to do here:
- Support simple generic support (i.e.
Param[MyConfig[int]])
- Support multi-field generic support
For (2), here is an example
Data = TypeVar("Data", bound=Base)
class Supervised(Base, Generic[Data]):
train: Param[Data]
"""The training dataset"""
validation: Param[Optional[Data]] = None
"""The validation dataset (optional)"""
test: Param[Optional[Data]] = None
"""The training optional"""
In that case, the three fields (train, validation, and test) should have the same base class (constrained by the TypeVar specification)
Currently, generics are not well supported in XPM, which prevents some basic type checking before running tasks – and this in turn can lead to errors that will only be detected when running the task. There are two things to do here:
Param[MyConfig[int]])For (2), here is an example
In that case, the three fields (
train,validation, andtest) should have the same base class (constrained by theTypeVarspecification)