Skip to content

feat: adopt powerio 0.2.2 and expose the PowerWorld .pwd display reader#45

Merged
qian-harvard merged 2 commits into
Power-Agent:mainfrom
samtalki:feat/powerio-0.2.2
Jun 15, 2026
Merged

feat: adopt powerio 0.2.2 and expose the PowerWorld .pwd display reader#45
qian-harvard merged 2 commits into
Power-Agent:mainfrom
samtalki:feat/powerio-0.2.2

Conversation

@samtalki

Copy link
Copy Markdown
Member

What

Adopt powerio 0.2.2 and finish wiring up the conversion server.

  • Bump the powerio pin to >=0.2.2.
  • powerio #119 (thanks @qian-harvard) moved the four folder/Parquet tools into the canonical powerio.mcp.server, so powerio_mcp.py drops its local overlay for them and re-exports all twelve canonical tools verbatim — the "canonical upstream, thin copy here" shape we've been converging on.
  • Add read_display_file, a thin overlay over the new .pwd display API from #120 (parse_display_file). It returns the one-line diagram's canvas and each substation's display coordinates, so a client can lay out a network without PowerWorld installed.

The one remaining overlay

powerio_mcp.py is now a pure re-export except for read_display_file. powerio 0.2.2 ships .pwd parsing as a Python API, but the canonical MCP server doesn't expose a display tool yet. Once it does upstream, this overlay deletes and the module becomes a pure re-export — the same lifecycle the folder/Parquet tools just finished. Glad to send that display-tool PR to powerio next if it's wanted.

Inherited for free

The 0.2.2 AUX name-keyed parsing, PSS/E v34 headers, and PTDF/LODF indefinite-Laplacian fallback reach the existing pandapower/PyPSA/Egret/ANDES bridges and the re-exported compute_matrix with no code change.

Tests

  • read_display_file decodes a vendored ACTIVSg200.pwd fixture (canvas + 111 substations) and maps a missing file to a clean error.
  • The existing folder/Parquet tests pass unchanged against the re-exported canonical tools, so the overlay deletion is behavior-preserving.
  • Full suite: 102 passed, 4 skipped (env-gated engines).

PowerMCP's own version is unchanged here; a release bump can follow separately.

🤖 Generated with Claude Code

samtalki and others added 2 commits June 14, 2026 16:49
powerio 0.2.2 moved the four folder/Parquet tools (read_pypsa_csv_folder,
write_pypsa_csv_folder, read_gridfm, write_gridfm) into the canonical
powerio.mcp.server (powerio #119), so powerio_mcp.py drops its local overlay
for them and re-exports all twelve canonical tools verbatim.

The one remaining overlay is read_display_file, wrapping the new .pwd display
API from powerio #120 (parse_display_file) until the canonical server exposes a
display tool of its own. It returns the one-line diagram canvas and each
substation's display coordinates.

- bump the powerio pin to >=0.2.2
- delete the 4-tool overlay; add those four names to the re-export
- add read_display_file + tests against a vendored ACTIVSg200.pwd fixture
  (un-ignored in .gitignore so it ships)
- the 0.2.2 AUX/PSS/E parsing and PTDF/LODF fixes reach the bridges and
  compute_matrix automatically, no code change

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- guard display.kind != "powerworld" so a future powerio display kind raises a
  clean ValueError instead of an opaque AttributeError (the pin is a >=0.2.2
  floor and powerio #120's scope mentions PSS/E display formats)
- fix the docstring return types: canvas dims and stamp are ints, not float/str
- importorskip powerio with minversion="0.2.2" so the suite skips, rather than
  errors, on a stale powerio that predates the canonical tools
- add a corrupt-.pwd regression test (PowerIOParseError maps to ValueError)
- narrow the .gitignore negation to the exact fixture, not *.pwd, so a private
  .pwd dropped in tests/data/powerworld/ stays ignored

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@samtalki

Copy link
Copy Markdown
Member Author

@qian-harvard ready for your review

@qian-harvard qian-harvard left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — LGTM. This is exactly the "pure re-export + thin overlay" endgame we'd converged on.

  • The four folder/Parquet tools now come from powerio.mcp.server (upstreamed in powerio #119), and the previously-needed _load/_summary private imports are correctly dropped — no dead imports or dangling refs.
  • read_display_file maps PowerIOError/FileNotFoundError/OSErrorValueError (the server's one-error-shape convention) and guards display.kind != "powerworld" before touching display.data, avoiding an opaque AttributeError on any future display kind.
  • Pin bump to >=0.2.2 is consistent with depending on the upstreamed tools.
  • Error-mapping + decode tests cover the new overlay; the folder/Parquet tests pass unchanged against the re-exported tools, so the overlay deletion is behavior-preserving.

CI green on py3.10/py3.12.

🤖 Reviewed with Claude Code

@qian-harvard qian-harvard merged commit 16f4957 into Power-Agent:main Jun 15, 2026
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