Implement Phase 7: PyO3 Python bindings#8
Merged
Conversation
Add maturin-based Python package exposing config loading, graph index, node reads, and BFS/DFS traversal with asyncio-friendly async wrappers. Includes type stubs, pytest suite, wheel CI job, and example agent script. Co-authored-by: Alex Merced <alex@alexmerced.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 7 — Python bindings (PyO3) from the implementation plan: an async-friendly Python API for agents on top of the Rust core.
What was built
PyO3 module (
maggraph::python, feature-gated):load_config(path)/open_index(root_path)— config + index accessGraphIndex—list_nodes(),read_node(),traverse(from_id, depth, order)read_node_async()/traverse_async()— non-blocking viapyo3-async-runtimes+ Tokiospawn_blockingNode,TraversalResult,TraversalNode— metadata, Markdown reports,to_dict()MagGraphError— Python exception mapped from Rust errorsPython package (
python/):pyproject.toml,python-extfeature for wheels)__init__.pyi,py.typed)examples/python_agent.py— sync + async demoCI & docs
pythonCI job:maturin build,pytest, wheel artifact uploadplanning/PYTHON.md, updatedPROGRESS.md(Phase 7 complete)Try it
Test plan
cargo test --all(63 Rust tests)cargo clippy --all-targets -- -D warningspytest— 8 Python tests passexamples/python_agent.pyruns (sync + asyncio)Next
Phase 8 — wire MCP scaffold to these bindings; polish
SKILL.mdgeneration.Slack Thread