It might be nice if gdb's Python API supplied mypy type annotations. See http://mypy-lang.org/ Maybe this can be done via stub files: https://mypy.readthedocs.io/en/latest/stubs.html
I think stubs should be added to typeshed instead of maintaining them in the GDB project: https://github.com/python/typeshed New mypy releases would then include them, so it's not necessary to mess with mypy settings and updates would be much faster.
Adding them to an external project seems like it would have some drawbacks. They'd have to be maintained separately from gdb itself, and it seems like there would be some version skew. Is there a problem with maintaining them in gdb? Actually I was wondering if we could use some technique to ensure that they have to be up-to-date in the gdb tree, like generating code from some kind of .def file or the like.
You are probably right. Maintaining it in GDB also avoids problems with different versions. I was initially thinking about the update process. Mypy and typeshed are updated quite often, so this would also apply for the annotations. The annotations aren't too complicated though, so this is only a minor concern once they are good enough.
I hadn't considered changes in mypy -- that's a good point.
These are in typeshed now: https://github.com/python/typeshed/tree/master/stubs/gdb