As someone who has taken a couple of code bases of similar or larger size from no annotations to fully annotated more or less by himself over the course of the past two or three years, I can understand why this task may seem daunting and it certainly takes its time, so I understand the desire leveraging an automated tool like MonkeyType to take off some of the initial load. But I would like to nudge you towards considering doing more of the work yourself, since I’ve found it a very rewarding experience.
I am not convinced the quality of those type annotations is going to be particularly high, especially for things like generics, so it will probably end up being a lot of work to review the generated annotations until they don’t interfere with ergonomics in some way, so I am not sure you are actually saving yourself a significant amount of work.
The advantage of typed python is that it’s gradual, so you can gradually introduce type annotations starting from your core modules and increase the type checker’s strictness for the modules you’ve already typed as you go. I’ve found this is also a really good opportunity to learn more about your code and spot design problems, that went previously unnoticed. Starting from a codebase that’s already fully annotated by automatic tooling I think it’s actually more daunting and difficult to refactor them to be sane. That being said, some amount of automated help to reduce the tedium can make sense.
I am not convinced it makes sense to use something like MonkeyType in production in the hopes of getting slightly better results when in the end you will have to go over everything to make sure it’s actually ergonomic to work with going forward, since speaking from experience, bad type annotations are worse than no annotations.
On a side note: I would dissuade you from using --ignore-missing-imports
globally. It’s fine to get started, but you’re better off explicitly enabling the option for the packages/modules where you’re missing type hints, because otherwise you will potentially hide some mistakes in typed modules.
Example pyproject.toml — mypy overrides section for ignoring missing imports
[[tool.mypy.overrides]]
module = [
"alembic.*",
"magic.*",
"plaster.*",
"pyramid.*",
"pyramid_beaker.*",
"pyramid_layout.*",
"sqlalchemy.*",
"transaction.*",
"zope.sqlalchemy.*"
]
ignore_missing_imports = true