schrodinger.application.transforms.baseconfig module¶
- class schrodinger.application.transforms.baseconfig.PTransformWithConfig(**kwargs)¶
Bases:
PTransformBase class for PTransforms that use Pydantic models for configuration.
Subclasses should define a class variable
config_classpointing to a Pydantic BaseModel class. The constructor will automatically create an instance of this config class and store it asself.config.Example usage:
class MyTransformConfig(BaseModel): multiplier: float class MyTransform(PTransformWithConfig): config_class = MyTransformConfig def expand(self, pcoll): # Access configuration via self.config return pcoll | beam.Map(lambda x: x * self.config.multiplier)
- config_class: Type[BaseModel] = None¶
- __init__(**kwargs)¶
Initialize the transform with configuration.
All keyword arguments are passed to the config_class constructor to create a validated configuration instance stored as self.config.
- Parameters:
kwargs – Configuration parameters for the config_class
- Raises:
AttributeError – If config_class is not defined on the subclass
ValidationError – If the configuration parameters are invalid
- classmethod from_config(config_instance: BaseModel)¶
- display_data() Dict[str, Any]¶
Return display data for the transform based on the configuration.
Automatically generates display data from all fields in the config, converting values to strings for display purposes.
- Returns:
Dictionary of configuration data for display