Typehints (see PEP484) make it easier to read and understand code (by default the "type" of objects in Python is dynamically determined and can change, adding typehints clarifies intent). Newer code that has been developed includes typehints.
The MonkeyType tool can be used to determine and apply types across an existing code base and the pytest-monkeytype package facilitates applying this to existing code bases.
Once in place we can then introduce type checkers such as mypy into the pre-commit pipeline.
Typehints (see PEP484) make it easier to read and understand code (by default the "type" of objects in Python is dynamically determined and can change, adding typehints clarifies intent). Newer code that has been developed includes typehints.
The MonkeyType tool can be used to determine and apply types across an existing code base and the pytest-monkeytype package facilitates applying this to existing code bases.
Once in place we can then introduce type checkers such as mypy into the pre-commit pipeline.