You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose --no-viz flag and/or GRAPHIFY_VIZ_NODE_LIMIT env var #541
graphify hook install writes a .git/hooks/post-commit whose _HOOK_SCRIPT calls to_html() unconditionally. On graphs with more than ~5,000 nodes, to_html() raises (the pyvis layout pass blows up). The hook fails after every commit on large repos.
We patched our local copy of the hook (2026-04-25) to gate the viz step:
ifG.number_of_nodes() <=5000:
to_html(...)
else:
print('[graphify hook] HTML viz skipped (> 5000 nodes); graph.json + GRAPH_REPORT.md updated.')
But graphify hook install regenerates the script from upstream _HOOK_SCRIPT, clobbering the patch on every reinstall.
Reproducer
Install the hook on any repo whose code-graph exceeds 5,000 nodes (a 50k-LOC Django project does it).
Make a commit.
Observe the hook fail during to_html rendering.
Proposal
Any one of:
Flag.graphify hook install --no-viz — generates a hook that skips to_html entirely. Simplest, opt-in.
Env var.GRAPHIFY_VIZ_NODE_LIMIT=5000 (default) — the generated hook reads the env var and skips to_html above the threshold, printing a warning. Zero-config for most users; tunable for large repos.
Both. Env var as default behavior, --no-viz as explicit opt-out.
Option 2 is the safest default — the hook stays useful on every repo size without manual patching, and CI consumers (who don't need the HTML) can set the limit to 0.
Motivation
Keeps the post-commit hook trustworthy across repo sizes. Also unblocks downstream users who don't need the HTML viz at all (CI runners, headless dev boxes).
Opened #565 to address this — implements both APIs you proposed:
GRAPHIFY_VIZ_NODE_LIMIT env var (your option 2) — overrides MAX_NODES_FOR_VIZ without patching the package, supports 0 to disable viz unconditionally for CI.
--no-viz flag in cluster-only (your option 1, narrowed to the CLI command that actually crashes today on v5).
The hook script itself doesn't need a direct change on v5: _HOOK_SCRIPT calls _rebuild_code() from watch.py, which already wraps to_html() in try/except ValueError. So with this PR merged, your hook is safe by default (no crash) and tunable via env var (no manual patching after graphify hook install).
If you'd rather have an explicit graphify hook install --no-viz flag too (your option 1's stricter form, generating a hook variant that skips viz entirely), happy to add it as a follow-up — kept it out of #565 to keep the diff small.
Fixed in v0.6.3. The cluster-only command now wraps to_html in try/except ValueError — graphs with >5000 nodes skip HTML viz gracefully instead of crashing, consistent with the watch/hook path.
Activity
market4drill commentedon Apr 27, 2026
Opened #565 to address this — implements both APIs you proposed:
GRAPHIFY_VIZ_NODE_LIMITenv var (your option 2) — overridesMAX_NODES_FOR_VIZwithout patching the package, supports0to disable viz unconditionally for CI.--no-vizflag incluster-only(your option 1, narrowed to the CLI command that actually crashes today onv5).The hook script itself doesn't need a direct change on
v5:_HOOK_SCRIPTcalls_rebuild_code()fromwatch.py, which already wrapsto_html()intry/except ValueError. So with this PR merged, your hook is safe by default (no crash) and tunable via env var (no manual patching aftergraphify hook install).If you'd rather have an explicit
graphify hook install --no-vizflag too (your option 1's stricter form, generating a hook variant that skips viz entirely), happy to add it as a follow-up — kept it out of #565 to keep the diff small.safishamsi commentedon May 2, 2026
Fixed in v0.6.3. The
cluster-onlycommand now wrapsto_htmlin try/except ValueError — graphs with >5000 nodes skip HTML viz gracefully instead of crashing, consistent with the watch/hook path.Wire --no-viz flag in cluster-only + GRAPHIFY_VIZ_NODE_LIMIT env var (c…