Report Generation¶
Functions for generating HTML reports with SVG charts.
Report Functions¶
generate_html_report ¶
generate_html_report(
stats: list[dict[str, Any]],
output_file: str,
history: dict[str, list[dict[str, Any]]] | None = None,
packages: list[str] | None = None,
env_summary: EnvSummary | None = None,
github_stats: dict[str, RepoStats] | None = None,
) -> None
Generate a self-contained HTML report with inline SVG charts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stats
|
list[dict[str, Any]]
|
List of package statistics |
required |
output_file
|
str
|
Path to write HTML file |
required |
history
|
dict[str, list[dict[str, Any]]] | None
|
Historical data for time-series chart |
None
|
packages
|
list[str] | None
|
List of package names (unused, kept for compatibility) |
None
|
env_summary
|
EnvSummary | None
|
Pre-fetched Python version and OS summary data |
None
|
github_stats
|
dict[str, RepoStats] | None
|
Dict mapping package names to RepoStats (optional) |
None
|
generate_package_html_report ¶
generate_package_html_report(
package: str,
output_file: str,
stats: PackageStats | None = None,
history: list[dict[str, Any]] | None = None,
python_versions: list[CategoryDownloads] | None = None,
os_stats: list[CategoryDownloads] | None = None,
) -> bool
Generate a detailed HTML report for a single package.
Includes download stats, Python version distribution, and OS breakdown. Uses cached env data if provided, otherwise fetches live from PyPI.
generate_project_html_report ¶
generate_project_html_report(
package: str,
output_file: str,
stats: PackageStats | None = None,
history: list[dict[str, Any]] | None = None,
pypi_releases: list[PyPIRelease] | None = None,
github_releases: list[GitHubRelease] | None = None,
python_versions: list[CategoryDownloads] | None = None,
os_stats: list[CategoryDownloads] | None = None,
) -> bool
Generate a project view HTML report with release timeline.
Shows download history with release markers, release table, and environment distribution.
Chart Components¶
make_svg_pie_chart ¶
Generate an SVG pie chart.