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

chore: add type validation to core commands

Open Panaetius opened this issue 3 years ago • 3 comments

adds pydantic type checks to all renku.core.command commands. This way we don't need to check if something decorated as one type is actually another type.

It already helped to find some bugs that I fixed here as well.

closes #3188

Panaetius avatar Nov 18 '22 18:11 Panaetius

I had to resolve conflicts but the conflicts were only in the poetry.lock file which were fixed by simply re-locking the file. So my approving this PR is still OK IMO.

olevski avatar Nov 25 '22 08:11 olevski

@Panaetius now mypy fails in a bunch of places. Not sure how it did not fail before.

olevski avatar Nov 25 '22 09:11 olevski

There's only 3 errors, the rest note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] is just a warning

renku/command/login.py:138: error: Argument "repository" to "_set_git_credential_helper" has incompatible type "Optional[Repository]"; expected "Repository"  [arg-type]
renku/command/login.py:148: error: Argument "repository" to "_set_renku_url_for_remote" has incompatible type "Optional[Repository]"; expected "Repository"  [arg-type]
renku/command/init.py:184: error: Argument "input_parameters" to "set_template_parameters" has incompatible type "Optional[Dict[str, str]]"; expected "Dict[str, str]"  [arg-type]

Panaetius avatar Nov 28 '22 09:11 Panaetius