python / mypy

Optional static typing for Python
https://www.mypy-lang.org/
Other
18.4k stars 2.82k forks source link

Plugin documentation is a little lacking #9020

Open plokmijnuhby opened 4 years ago

plokmijnuhby commented 4 years ago

Ideally it should be possible to use the interface without having to dig through the source code, but that's not really possible. The docs mention that the callbacks returned by the hooks will receive APIs, but don't explain what those APIs are at all. It should also be mentioned that get_additional_deps has a different interface to the other plugin functions, and this detail should appear in the docs as well.

JukkaL commented 4 years ago

The documentation is pretty minimal. The problem with documenting all of the plugin API would be that there is a lot of potential things plugins may need access to, and keeping the documentation up to date with the implementation would be a lot of work that requires a deep understanding of mypy internals. Some additional documentation would certainly be fairly easy to add. Perhaps we should look for things that many plugins use and document those, for example.

plokmijnuhby commented 4 years ago

So, as I understand it, the hooks the plugin produces are all given various kinds of named tuple. The exact structure varies, but the most common field names are api, context, and type. Seems like those are good ones to focus on.