mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Add direct HTML reporter to replace XSLT-based output (ideia to fix issue #909)

Open brxno3107 opened this issue 7 months ago • 1 comments

Objective

This PR introduces a new HTML reporter (html-direct) that generates reports directly using Python, without relying on XSLT transformations. This solves the long-standing issue #909 regarding WebKit browsers failing to render file:// XSL-based reports.

What was done

  • Created html_report.py with MemoryHtmlReporter and HtmlReporter classes
  • Generates one HTML per file, plus an index.html summary
  • Copies fallback CSS if missing (mypy-html.css)
  • Registered reporters via register_reporter("html-direct", ...)

Usage

Run with:

mypy your_file.py --html-direct-report output_dir/

brxno3107 avatar Jun 02 '25 23:06 brxno3107

Diff from mypy_primer, showing the effect of this PR on open source code:

colour (https://github.com/colour-science/colour): 1.05x faster (1770.8s -> 1684.9s in single noisy sample)

antidote (https://github.com/Finistere/antidote): 1.13x slower (57.3s -> 64.8s in single noisy sample)

pandera (https://github.com/pandera-dev/pandera): 1.12x slower (135.5s -> 152.0s in single noisy sample)

discord.py (https://github.com/Rapptz/discord.py): 1.11x slower (269.6s -> 299.1s in single noisy sample)

github-actions[bot] avatar Jun 02 '25 23:06 github-actions[bot]