KEMBAR78
Cannot dump parse tree with mypy.parse · Issue #7807 · python/mypy · GitHub
Skip to content

Cannot dump parse tree with mypy.parse #7807

@goodmami

Description

@goodmami

This is either a feature request or a documentation bug.

I found in the Getting Started Developing wiki the following bullet point:

  • You can parse a file and dump the parse tree by running mypy/parse.py as a script. This can make it easier to get familiar with the internals.

However that does not seem to be true; mypy/parse.py does not contain any code for running it as a script. In fact it used to have such code, but it was removed along with thousands of other lines when an old parser was taken out (see a8c7947). There was no mention of removing the script functionality in the PR (#2977) so I suspect it was an accident. Nobody seems to have missed it enough the past 2.5 years to raise an issue, but I'm just getting acquainted with mypy's internals and would like to have such easy access to the parse tree to help with debugging.

I propose one of the following fixes:

  1. Re-add the script functionality to mypy.parse (I already have a commit ready: https://github.com/goodmami/mypy/commit/dddabd94762c5f762e3299b318b0d74e5cd57c10)
  2. Add it under scripts/ (e.g., scripts/dumpast.py)
  3. Update the wiki

If people agree to (1) above, I'll go ahead and create the PR, or I can take care of (2) or (3).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions