Plugin Interfaces
Abstract base classes for extending crategraph. Implement these to add support for new data formats, visualisation engines, or validation rules.
Reader
crategraph.core.interfaces.Reader
Bases: ABC
Base class for graph readers (e.g. RO-Crate, GEXF).
Source code in crategraph/core/interfaces.py
can_read(path)
abstractmethod
Writer
crategraph.core.interfaces.Writer
Bases: ABC
Base class for graph writers (e.g. JSON-LD, GEXF).
Source code in crategraph/core/interfaces.py
can_write(path)
abstractmethod
Renderer
crategraph.core.interfaces.Renderer
Bases: ABC
Base class for graph renderers (visualisation backends).
Concrete renderers should support these common parameters where applicable:
colour_by: How to assign node colours (e.g."type","community").size_by: How to scale node sizes (e.g."connections").edge_width: Per-edge width.None= renderer default;int/float= literal pixel width for every edge;str= property name, width-encoded via1 + 2*log1p(v).filepath: Save output to a file path instead of returning an in-memory object.height/width: Canvas dimensions.
Renderer-specific parameters can be accepted via **kwargs.
Source code in crategraph/core/interfaces.py
Validator
crategraph.core.interfaces.Validator
Bases: ABC
Base class for graph validators (data quality checks).
Source code in crategraph/core/interfaces.py
Inspector
crategraph.core.interfaces.Inspector
Bases: ABC
Base class for file inspectors.
Concrete inspectors examine data files referenced by entities and return structured information about them.
Source code in crategraph/core/interfaces.py
inspect(path)
abstractmethod
Viewer
crategraph.core.interfaces.Viewer
Bases: ABC
Base class for file viewers.
Concrete viewers produce rich HTML previews of data files referenced by entities — images displayed as images, CSVs as interactive tables, audio with playback controls.
Source code in crategraph/core/interfaces.py
supports(path)
abstractmethod
view(path)
abstractmethod
View the file at path and return a rich HTML preview.
Implementers must HTML-escape all content derived from file data
or entity properties before embedding it in the returned
ViewInfo.html.