feat: sync the powerio server with upstream 0.1.1#35
Conversation
…memory powerio 0.1.0 ships convert_str, so the server's inline conversion no longer stages temp files; the _EXT/_stage/_unlink_quietly machinery is gone. The file is now a faithful copy of the canonical powerio.mcp.server (same eight tools, the docstring polish from its review, the save_case newline fix both copies already shared), with the standalone header pointing at upstream. The powerio extra pins >=0.1.0 and a regression test asserts inline conversion never touches tempfile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PyPSA bridge: drop out-of-service branches and generators before import_from_pypower_ppc, which ignores the ppc status columns; gencost rows are realigned after generator drops. pandapower's from_ppc honors status so its bridge is unchanged (documented by a new test). powerio server: shadow-import guard on startup; explicit laplacian elif with unreachable-else guard; OSError arm in convert_case; belt-and- braces (ValueError/KeyError/TypeError) arm in _load. tests: 7 new cases covering OOS branch/generator drops, pandapower status contrast, laplacian matrix, bad-JSON ValueError, and OSError normalization. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5d3c23e to
73ee997
Compare
|
This PR is now rebased on main and includes all of Qian's fixes from #34 (PyPSA OOS drop, shadow-import guard, error normalization, laplacian elif). 91 tests pass on Python 3.12. One thing worth flagging: powermcp 0.1.1 shipped with a silent topology bug in the PyPSA bridge. If you agree it warrants a patch, a 0.1.2 release after this merges would be a clean way to get the fix to users. Happy to do whatever's most useful — just mention it and I'll handle the prep. |
Upstream landed the error-shape hardening from the Power-Agent#34 review (eigenergy/powerio#93, released as 0.1.1): _parse maps an unreadable file (OSError) to the documented ValueError shape, convert_case says "cannot read file" instead of "conversion failed" for that case, and the defensive-arm comments came along. Ports the upstream suite's unreadable-file and wrong-schema tests. No new powerio API, so the >=0.1.0 floor stands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds load_network_from_json and load_network_from_any to ANDES/andes_mcp.py,
following the same pattern as the PyPSA bridge. Both tools accept a powerio
JSON transport string or any powerio-readable file (MATPOWER, PSS/E, PowerWorld
.aux, PowerModels JSON, egret JSON), convert to MATPOWER via powerio's
case.to_format("matpower"), and write the result to out_path for ANDES to
consume via run_power_flow. Bumps the powerio extra pin to >=0.1.1 to match
the 0.1.1 server already on this branch.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@qian-harvard — carried your OOS fix and error hardening from #34 into this branch (see |
Follow-up to #28, against the released powerio 0.1.1 (release notes).
convert_str, soconvert_caseno longer stages inline content to temp files; the_EXT/_stage/_unlink_quietlymachinery is deleted and a regression test asserts the tool never touchestempfile.powerio.mcp.server, declared canonical in feat: upstream the full PowerMCP tool surface into powerio.mcp.server eigenergy/powerio#90): same eight tools, plus the docstring improvements from its review (accuratejson=acceptance lists, "reference bus index" indense_view, tightened module docstring). The standalone header points back at upstream so future syncs have a direction.powerioextra pins>=0.1.0(older versions lackconvert_str).Suite: 85 passed, 1 skipped (the Windows-only detect test, per #29's skipif). The server still runs standalone (
python powerio/powerio_mcp.py) andpowermcp list/doctorare unchanged.🤖 Generated with Claude Code