PyPI downloads example: total chart, direct line, in-memory cache#203
Merged
PyPI downloads example: total chart, direct line, in-memory cache#203
Conversation
… example - Add query_total.sql for the package's own weekly downloads - Replace CSV/file caching with in-memory cache - Add total downloads chart above dependents chart - Compute "direct" line (total - sum of dependents) in dependents chart - Add checkbox to toggle direct downloads visibility - Add reactive page header using defer/insert pattern - Simplify query.py (remove CLI entry point and file I/O) - Default date range to 6 months
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PyPI downloads example previously required pre-fetching data to CSV before the server could start, and only showed dependent package downloads. This rework makes the example self-contained and more informative.
The dashboard now shows the package's own total weekly downloads in a chart above the dependents chart. A "direct" line in the dependents chart estimates downloads not attributable to any tracked dependent (total minus sum of top-20 dependents). A checkbox toggles the direct line instantly via a lightweight
/api/renderendpoint that re-renders from an in-memory cache without re-querying ClickHouse.The page header is reactive — it updates as you type in the package name field, using the
defer/insertpattern:All file-based caching (CSV, meta JSON) is replaced with a simple in-memory dict, so the server starts clean and fetches data on demand.