Programmatically generating solids (Solid factories):

You may find the need to create utilities that help generate solids.

Generally, you want to parameterize solid behavior by adding solid configuration. You should reach for this pattern if you find yourself needing to vary the SolidDefinition or @solid decorator arguments themselves, since they cannot be modified based on solid configuration.

General solid factory pattern:

solids.py
def x_solid(
    arg, name="default_name", input_defs=None, **kwargs,
):
    """
    Args:
        args (any): One or more arguments used to generate the nwe solid
        name (str): The name of the new solid.
        input_defs (list[InputDefinition]): Any input definitions for the new solid. Default: None.

    Returns:
        function: The new solid.
    """

    @solid(name=name, input_defs=input_defs or [InputDefinition("start", Nothing)], **kwargs)
    def _x_solid(context):
        # Solid logic here
        pass

    return _x_solid