Skip to content

Implement Phase 7: PyO3 Python bindings#8

Merged
AlexMercedCoder merged 1 commit into
mainfrom
cursor/phase-7-python-f814
Jun 4, 2026
Merged

Implement Phase 7: PyO3 Python bindings#8
AlexMercedCoder merged 1 commit into
mainfrom
cursor/phase-7-python-f814

Conversation

@AlexMercedCoder
Copy link
Copy Markdown
Owner

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 access
  • GraphIndexlist_nodes(), read_node(), traverse(from_id, depth, order)
  • read_node_async() / traverse_async() — non-blocking via pyo3-async-runtimes + Tokio spawn_blocking
  • Node, TraversalResult, TraversalNode — metadata, Markdown reports, to_dict()
  • MagGraphError — Python exception mapped from Rust errors

Python package (python/):

  • Maturin build (pyproject.toml, python-ext feature for wheels)
  • Type stubs (__init__.pyi, py.typed)
  • 8 pytest tests (sync + asyncio)
  • examples/python_agent.py — sync + async demo

CI & docs

  • New python CI job: maturin build, pytest, wheel artifact upload
  • planning/PYTHON.md, updated PROGRESS.md (Phase 7 complete)

Try it

cd python
python -m venv .venv && source .venv/bin/activate
pip install maturin pytest pytest-asyncio
maturin develop --release --features python-ext
pytest -v
python ../examples/python_agent.py

Test plan

  • cargo test --all (63 Rust tests)
  • cargo clippy --all-targets -- -D warnings
  • pytest — 8 Python tests pass
  • examples/python_agent.py runs (sync + asyncio)

Next

Phase 8 — wire MCP scaffold to these bindings; polish SKILL.md generation.

Slack Thread

Open in Web Open in Cursor 

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>
@AlexMercedCoder AlexMercedCoder marked this pull request as ready for review June 4, 2026 18:23
@AlexMercedCoder AlexMercedCoder merged commit b3b1b92 into main Jun 4, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants