Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

brxno3107
Copy link

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/

Copy link
Contributor

github-actions bot commented Jun 2, 2025

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)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant