This is an attempt at introducing greater rigour in how we use mypy types. This PR is mostly supposed to be a starting point for discussions, not necessarily useful in itself.
The sml_sync.screens.components subpackage now has full typechecking, including on all private methods. This subpackage heavily dependent on prompt_toolkit, which doesn't have type annotations, so I've written some stubs by just reading the code on GitHub.
This exercise has lead to some tidying of import structures (we were frequently importing classes from prompt_toolkit.layout.containers or prompt_toolkit.layout.controls, instead of directly from prompt_toolkit.layout, for instance), so it's been somewhat beneficial for the codebase. Nevertheless, type annotations do add complexity, so I'm open to deciding we don't want these.
If we do decide to merge this, we should test it in Travis.
This is an attempt at introducing greater rigour in how we use mypy types. This PR is mostly supposed to be a starting point for discussions, not necessarily useful in itself.
The
sml_sync.screens.components
subpackage now has full typechecking, including on all private methods. This subpackage heavily dependent on prompt_toolkit, which doesn't have type annotations, so I've written some stubs by just reading the code on GitHub.This exercise has lead to some tidying of import structures (we were frequently importing classes from
prompt_toolkit.layout.containers
orprompt_toolkit.layout.controls
, instead of directly fromprompt_toolkit.layout
, for instance), so it's been somewhat beneficial for the codebase. Nevertheless, type annotations do add complexity, so I'm open to deciding we don't want these.If we do decide to merge this, we should test it in Travis.
To reproduce, run: