Open s-breeze opened 6 months ago
Sorry for only getting to this now! I like implementation and the idea is neat, but I'm missing a bit more info on what the usecase is here. I'd only want to add features that have a well-defined usecase so as to minimize what we have to maintain.
I understand how the feature should work, but I'm missing some examples on what could replace the ...
in the following example.
import patito as pt
import polars as pl
class MyModel(pt.Model):
a: int
@pt.validate_hints
def func(arg: MyModel) -> MyModel:
# ... <- What should go here?
return arg
# this df will raise an error when validated
df = pl.DataFrame({"a": [1.0, 2.0, 3.0]})
func(df)
MyModel.validate(df) # this does the same thing as the above
@validate_hints
decorates functions or methods running.validate
on function arguments and the return value if they inherit frompt.pydantic.ModelMetaclass
. Example usage: