How robert-haas/gravis works
Project type and purpose
• Gravis is a Python library for graph visualization and conversion.
• It takes input graphs (from NetworkX, igraph, graph-tool, etc.), converts them into a generic JSON graph format (GJGF), and renders them as interactive visualizations using D3, vis-network, and 3D Force Graph (three.js).
File structure
• Top-level package:
• gravis/
– _internal/conversion: logic for converting various graph inputs into GJGF
– _internal/plotting: modules (d3.py, vis.py, three.py) that take GJGF and produce HTML/JS visualizations via template_system.
– _internal/utils: argument parsing, OS helpers, web helpers.
• Supporting directories:
• docs/: Sphinx documentation source and generated theme assets
• examples/: Jupyter notebooks demonstrating usage with sample data
• tests/: pytest-based automated tests
• Build and distribution: setup.py, setup.cfg, Makefile, tox.ini, MANIFEST.in.
README for additional insights
• Confirms it’s a PyPI-distributed, Apache-licensed package built with Sphinx.
Detail without overcomplicating
• Plotting engine separately.
• Template system as a shared resource used by all plotting backends.
• Documentation and test suites as ancillary packages but separated from the core runtime path.