Michael T
02/11/2021, 6:22 PMThe Dagster type system is independent from the PEP 484 Python type system, although we overload the type annotation syntax on functions to make it easier to specify the input and output types of your solids.
sandy
02/11/2021, 6:45 PMantonl
02/11/2021, 6:47 PMsandy
02/11/2021, 6:49 PM@solid(
input_defs=[InputDefinition(dagster_type=create_pandas_dataframe_type(/* express column constraints */))],
output_defs=[OutputDefinition(dagster_type=create_pandas_dataframe_type(/* express column constraints */))]
def my_solid(_, input1: pd.DataFrame) -> pd.DataFrame:
...
Michael T
02/11/2021, 7:07 PMantonl
02/11/2021, 7:09 PMMichael T
02/11/2021, 7:11 PMantonl
02/11/2021, 7:13 PMMichael T
02/11/2021, 7:15 PMantonl
02/11/2021, 7:16 PMTYPE_CHECKING
block, and create aliases to dagster.Any
otherwise.Michael T
02/11/2021, 7:19 PMsandy
02/11/2021, 7:19 PM@solid
def my_solid(_, input1: pd.DataFrame) -> pd.DataFrame:
...
Diff: https://dagster.phacility.com/D5115Michael T
02/11/2021, 7:19 PMantonl
02/11/2021, 7:21 PM_
. There is a @lambda_solid
decorator that doesn’t have this argument, but I think that may be going away. It makes the API hard to learn if there are multiple (sometimes-equivalent) ways of doing something.Michael T
02/11/2021, 7:22 PMsandy
02/11/2021, 7:22 PMantonl
02/11/2021, 7:24 PMsandy
02/11/2021, 7:25 PMMichael T
02/11/2021, 7:26 PMwith load_config as context:
)antonl
02/11/2021, 7:27 PM@configured
decorator that allows you to define solids with some configuration baked in.Michael T
02/11/2021, 7:27 PMantonl
02/11/2021, 7:28 PMsandy
02/11/2021, 7:28 PMwith load_config as context
would be outside the solid definition or inside?Michael T
02/11/2021, 7:31 PMsandy
02/11/2021, 7:35 PMMichael T
02/11/2021, 7:38 PMsandy
02/11/2021, 7:45 PM_
argument in the cases where I don't need access to a solid's context. As mentioned above, we used to put more emphasis on APIs like lambda_solid
that allowed users to avoid this, but ended up not finding it to be a big sticking point.Michael T
02/11/2021, 7:49 PM