Skip to content

Visualise Python project type completeness

License

Notifications You must be signed in to change notification settings

mjpieters/pyright-analysis

Repository files navigation

Generate a treemap graph from Pyright verifytypes output.

PyPI version License Python versions supported Built with uv Checked with Ruff Checked with Pyright Python checks Coverage

A simple cli tool to visualise the state of a Python project's type completeness, from the output of pyright's --outputjson --verifytypes command:

Sample graph output for prefect

The interactive graph depicts a projects modules as a tree, with each the size of each module based on the number of exported symbols.

Usage

Use a Python tool manager like uv tool or pipx:

$ uv tool install pyright
$ uv tool install pyright-analysis

Then generate a type compleness JSON report for your package, and transform the report into a graph:

$ pyright --outputjson --ignoreexternal --verifytypes PACKAGE > PACKAGE.json
$ pyright-analysis PACKAGE.json

This will open the resulting graph in your browser.

Full help documentation is available on the command-line:

pyright-analysis help output

Features

  • Interactive responsive graph. Hover over each package to get more detail about symbol counts and completeness, or click on packages to zoom in.
  • Export options:
    • Full stand-alone HTML page.
    • HTML div snippet with configurable HTML id.
    • Static image export as PNG, JPG, WebP, SVG or PDF.
    • Plotly JSON graph representation.

Development

This project uses uv to handle Python dependencies and environments; use uv sync to get an up-to-date virtualenv with all dependencies. This includes development dependencies such as Ruff (used for linting and formatting) and Pyright (used to validate type annotations).

Linting and formatting

While PRs and commits on GitHub are checked for linting and formatting issues, it's easier to check for issues locally first. After running uv sync, run uv run pre-commit install to install pre-commit hooks that will run these tools and format your changes automatically on commits. These hooks also run uv sync whenever you working tree changes.

Testing

This project uses pytest to run its tests: uv run pytest.

About

Visualise Python project type completeness

Topics

Resources

License

Stars

Watchers

Forks

Languages