Skip to content

Support reveal_type from dmypy #10510

@rowillia

Description

@rowillia

Feature

Support invoking reveal_type from dmypy (similar to suggest) to enable tooling to use mypy for type information.

Pitch

libCST is an extremely powerful tool for supporting refactoring Python code, and it has support for type information, but currently only supports Pyre:
https://libcst.readthedocs.io/en/latest/_modules/libcst/metadata/type_inference_provider.html#TypeInferenceProvider

Pyre and Mypy result in slightly different type information so I'd prefer to get our type data from mypy itself.

Existing solutions seem pretty janky -
https://github.com/fortana-co/sublime-mypy-reveal/blob/master/mypy_reveal.py#L72-L102 modifies the code and invokes reveal_type, https://github.com/matangover/mypy-vscode/blob/master/README.md#caveats imports mypy which isn't well supported.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions