renku-python icon indicating copy to clipboard operation
renku-python copied to clipboard

add runtime type-checking

Open Panaetius opened this issue 3 years ago • 3 comments

we have added types in most of our code and check it with mypy, but these checks are not enforced at runtime. But since they are there, we don't usually code defensively to make sure that what we get actually matches the expected type.

We should add pydantic and check types at runtime as well, to make the code more robust. We should also check if this has a performance impact and, if so, if we can live with it.

Panaetius avatar Oct 27 '22 17:10 Panaetius

Timeboxed. Check if this really works with runtime typechecking

Panaetius avatar Nov 02 '22 14:11 Panaetius

If I am not mistaken we would add this decorator to all our functions/methods.

But the pydantic documentation says that is still in beta. So perhaps we want to wait for it to mature more?

olevski avatar Nov 02 '22 14:11 olevski

There's also https://github.com/agronholm/typeguard and https://strongtyping.readthedocs.io/en/latest/

We probably don't want to add this to every method, but at least to all the commands (the interface to the outside world)

Panaetius avatar Nov 02 '22 15:11 Panaetius