Add a mypy run to the pipeline
This is a preparation for #332 (closed).
This MR adds a mypy lint job to the pipeline.
With this we can safely add python 3.6+ type definitions (PEP 484) to the codebase.
Excerpt from the website:
Why mypy?
- Compile-time type checking Static typing makes it easier to find bugs with less debugging.
- Easier maintenance Type declarations act as machine-checked documentation. Static typing makes your code easier to understand and easier to modify without introducing bugs.
- Grow your programs from dynamic to static typing You can develop programs with dynamic typing and add static typing after your code has matured, or migrate existing Python code to static typing.
current implementation
- mypy is run as a seperate gitlab job and fails on any new mypy error
- Some already existing errors are silenced and should probably be looked into in a follow up issue (search for
mypy errorortype: ignore). - imported packages which do not define type definitions are also ignored (as not all 3rd party modules have types defined)
further readings
- start small -> current issues are ignored to get started
- typing.Protocol and the future of duck typing -> avoid too strict type definitions
Edited by Bene