44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
"""
|
|
Graphgen — what a graph is, and where graphs come from.
|
|
|
|
Two halves, and they are independent:
|
|
|
|
graph.py the model. Nodes, edges, groups, and the meaning carried on
|
|
them. No colour, no font, no layout engine.
|
|
|
|
schema.py the first source. A `schema.json` or a modelgen `schema/`
|
|
folder becomes `{models, relationships, source}`, which
|
|
`api.py` serves at /station/tools/graphgen/api/schema and the
|
|
browser viewer draws.
|
|
|
|
`{models, relationships, source}` is a **published contract**, not an internal
|
|
shape: modelgen emits it (`generator/jsonschema.py`), datagen exposes it
|
|
(`base.py::schema`), shuntgen generates it, and `cfg/amar` reads it off disk.
|
|
Two modelgen tests assert it. It does not change to suit anything here.
|
|
|
|
The senses of "graph" parked for later — video pipeline processing graphs, local
|
|
computer-vision graphs, Supabase-style schema diagrams — are more *sources*.
|
|
They belong beside `schema.py`, feeding the one model, rather than each growing
|
|
its own drawing code.
|
|
|
|
## Drawing one is not this tool's job
|
|
|
|
`docgen` takes a graph and produces DOT, SVG, and documents, with the styling
|
|
supplied as a data profile. The dependency runs one way: docgen reads this
|
|
model structurally and imports nothing from here, so either folder works with
|
|
the other absent. `docgen/shape.py` is that contract, written down.
|
|
|
|
from graphgen import Graph
|
|
from docgen import Profile, emit, render # the other half, if present
|
|
|
|
## Importing this is cheap
|
|
|
|
`api.py` is deliberately not imported here. Pulling in the model must not pull
|
|
in FastAPI — `run.py` imports `station.tools.graphgen.api` explicitly when it
|
|
mounts the router, and nothing else should have to pay for that.
|
|
"""
|
|
|
|
from .graph import CLASSES, Edge, Graph, Group, Node
|
|
|
|
__all__ = ["Graph", "Node", "Edge", "Group", "CLASSES"]
|