A library for visualizing semantic-state-machine structures and AuditContext execution paths as graphs using graphable.
- StateMachineGraph: Visualize the static structure of a
semantic-state-machine.StateMachine. - AuditContextGraph: Visualize the execution history of an
AuditContextas a graph, with edges annotated by transition indices.
The project is managed with uv. To install dependencies:
uv syncpip install semantic-state-machine-graphableThe project employs a tiered testing strategy:
- Unit & Integration: Run with
pytest. - Property-based Fuzzing: Run with
pytest tests/hypothesis. These are powered byhypothesisand provide robust edge-case coverage.
Run the full test suite:
uv run pytest testsfrom semantic_state_machine_graphable import StateMachineGraph
graph = StateMachineGraph(sm)
# Export to DOT format
dot_output = graph.to_dot()
print(dot_output)
# To visualize with Graphviz, you can use the command line:
# echo '...' | dot -Tpng -o state_machine.pngfrom semantic_state_machine_graphable import AuditContextGraph
graph = AuditContextGraph(ctx, sm)
# Export to DOT format
dot_output = graph.to_dot()
print(dot_output)
# To visualize with Graphviz:
# echo '...' | dot -Tpng -o audit_path.pngThis project is licensed under the MIT License.