Introduce a pre-commit hook and MyPy, implement type hints in a few files
We should move further towards modern techniques and this is yet another step in that direction.
I do not try and sort it all here - it would mean a gigantic MR! - but this is already more than enough as a "take 1".