Skip to content

feat: expose the synth generators through powerio-py and the MCP server#89

Draft
samtalki wants to merge 1 commit into
mainfrom
feat/synth-python
Draft

feat: expose the synth generators through powerio-py and the MCP server#89
samtalki wants to merge 1 commit into
mainfrom
feat/synth-python

Conversation

@samtalki

Copy link
Copy Markdown
Member

Closes #86.

powerio-matrix's synth generators (generate_tree / generate_lattice / generate_pegase_like) were reachable only through the powerio gen CLI subcommand. This adds:

  • #[pyfunction] generate_case(topology=None, n=64, r_over_x=0.1, mean_x=0.05, seed=0xC0FFEE) dispatching through synth::generate, with a parse_topology helper following the existing parse_scheme/parse_convention pattern (tree, lattice/lattice2d, pegase/pegase-like, case and separator insensitive).
  • powerio.generate_case(...) -> Network wrapper, __all__, and stub updates.
  • A generate_case MCP tool returning {"json", "summary"}, so synthetic cases flow into the same JSON transport pipeline as parsed ones.

Tests: tree defaults (n-1 branches, radial, bus 1 REF, no gens/loads/shunts), lattice rounding to the next perfect square, pegase-like meshing, seed determinism, JSON round trip, matrix builders on a generated case, unknown topology error, and the MCP tool. cargo test/clippy --all-targets/clippy -p powerio-py --features extension-module,gridfm -D warnings/fmt --check and pytest python/tests (76 passed, 2 skipped) are green.

Independent of #88; no version bump.

🤖 Generated with Claude Code

One generate_case(topology, n, r_over_x, mean_x, seed) pyfunction dispatching
through synth::generate, with a parse_topology helper following parse_scheme.
Python wrapper powerio.generate_case(...) -> Network with stub updates, and a
generate_case MCP tool returning {"json", "summary"} so synthetic cases enter
the same transport pipeline as parsed ones. Defaults match SynthSpec::default
and identical seeds generate identical cases.

Closes #86.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@samtalki samtalki force-pushed the feat/synth-python branch from afd30bf to bd8b261 Compare June 10, 2026 18:03
@samtalki samtalki marked this pull request as draft June 10, 2026 18:13
@samtalki

samtalki commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Parked as draft for the 0.1.3 cycle: the synth generators stay an internal test tool for now. Whether and how they become public API (own crate, naming, scope) is open for discussion in the RFC issue; this PR's Python/MCP surface follows that decision.

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.

Expose the synth generators through powerio-py and the MCP server

1 participant