Add HTML sampling for 5000+ node graphs and extraction progress logging (#52)#96
Closed
azizur100389 wants to merge 2 commits into
Closed
Conversation
Three improvements for large-scale projects: 1. tree-sitter version mismatch: catch TypeError in _extract_generic() and return a clear error message suggesting pip upgrade, instead of a cryptic traceback when Language() API changes between versions. 2. HTML visualization sampling: add sample_for_viz() that selects top-N communities and highest-degree nodes per community. to_html() now accepts sample=True to auto-sample instead of raising ValueError on graphs exceeding 5000 nodes. 3. Extraction progress logging: extract() now logs periodic progress (every 10% or 100 files) showing files processed, cached, skipped, and errors — gives users feedback during large batch extractions.
patch.dict(sys.modules) requires a real module object, not a dynamic class instance. Use types.ModuleType to create a proper fake module that works across Python 3.10 and 3.12.
996abbc to
5858460
Compare
Contributor
Author
|
Closing this multi-fix PR (it targets the stale v3 branch). Replaced by a focused, single-purpose PR on v6 — see #NEW. The other two changes from this PR are no longer needed: progress logging is already in v6 (parallel/sequential extraction loops emit it), and HTML sampling overlaps with v6's GRAPHIFY_VIZ_NODE_LIMIT env-var approach so I left v6's design as-is. |
2 tasks
Contributor
Author
|
Replaced by #671 (focused single-fix PR on v6: just the tree-sitter TypeError hint, dropped the now-redundant progress logging and the sampling change that overlaps with GRAPHIFY_VIZ_NODE_LIMIT). |
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.
Summary
Addresses three sub-issues from #52 (Large-Scale App Project Analysis):
_extract_generic()now catchesTypeErrorfromLanguage()API changes and returns a clear error message suggestingpip install --upgrade tree-sitter, instead of an opaque tracebacksample_for_viz()that selects the top-N largest communities and highest-degree nodes per community.to_html()acceptssample=Trueto auto-sample instead of raisingValueErroron graphs exceeding 5,000 nodesextract()now logs periodic progress (every 10% or 100 files) showing files processed, cached, skipped, and errors — users get feedback during large batch extractions instead of silenceNote: sub-issues 2 and 3 from #52 were already fixed in v3 (
_resolve_cross_file_importsguard and_ASSET_DIR_MARKERSfor xcassets).Test plan
tests/test_issue52.py)sample_for_vizproduces subgraphs under 5,000 nodes