Automate annotation of legacy code

There are tools for automatically adding draft annotationsbased on type profiles collected at runtime. Tools includeMonkeyType (Python 3) and PyAnnotate(type comments only).

A simple approach is to collect types from test runs. This may workwell if your test coverage is good (and if your tests aren’t veryslow).

Another approach is to enable type collection for a small, randomfraction of production network requests. This clearly requires morecare, as type collection could impact the reliability or theperformance of your service.