Siuba uses type hints to dispatch the appropriate versions of custom functions!
For example, siuba allows users to create custom functions using a thin wrapper around functools.singledispatch.
When deciding how to run...
df >> filter(my_custom_func(_.x))
It requires that the return type be compatible with the backend being run (e.g. pandas, a SQL dialect).Would be super interesting to try and lay out what would be needed to do static analysis via mypy. I think it'd require some plugins for singledispatch at least, probably some reworking things in ways myoy expects.
https://nbviewer.jupyter.org/github/machow/siuba/blob/master...