Skip to content

Pre-publication polish: usable step-by-step pipeline, GridStudio docs, Apache-2.0 - #3

Merged
mshyang merged 3 commits into
mainfrom
prepublish-polish
Nov 12, 2026
Merged

mshyang merged 3 commits into
mainfrom
prepublish-polish

Conversation

@mshyang

@mshyang mshyang commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Pre-publication pass over usability and clarity. The import and distribution name stay powergrid_synth; the project is presented as GridStudio.

The three commits are separable and easier to read one at a time. The first is almost entirely the removal of 70 built documentation files.

What changes for users

Step-by-step pipeline now produces a complete grid. Before, each stage returned a dict and the caller had to copy it onto the graph with networkx.set_node_attributes. Skipping that gave a grid with no generators and no loads, with no error. Now:

  • BusTypeAllocator.allocate(), CapacityAllocator.allocate(), LoadAllocator.allocate(), LoadAllocator.allocate_reactive() and GenerationDispatcher.dispatch() store bus_type, pg_max, pl, ql and pg on the graph and still return them. update_graph=False restores return-only behaviour.
  • Running a stage before the one it depends on raises a ValueError that names the stage to run first.

Distribution feeders meet the requested totals. Negative shares were redrawn without renormalising, so loads overshot the request (median 1.7 times total_load_mw at 200 nodes with default parameters). Shares are now rescaled. Power values for a given seed change; topology does not. match_totals=False gives the earlier values.

Output is controllable. Messages go through the powergrid_synth logger. synthesize() and synthesize_distribution() accept verbose=False, and powergrid_synth.set_verbosity("silent" | "warning" | "info" | "debug") sets the package level. Per-iteration detail moved to debug.

Smaller fixes

  • Unknown export formats and a missing pandapower are reported before the pipeline runs.
  • synthesize(export_formats=None) writes no files.
  • Reference mode keeps base_kv_map on the graph, so a later export matches the one synthesize() makes.
  • Missing-dependency errors give an install-from-GitHub command; the old hint pointed at PyPI, where the package does not exist.
  • Excel export works with the [export] extra (xlsxwriter and openpyxl were missing).
  • SchweetzerFeederGenerator is renamed SchweitzerFeederGenerator; the old name still works and warns.

Docs, examples and packaging

  • README rewritten: working install command, a table of the attributes on returned graphs, step-by-step examples that run, corrected references (two DOIs did not resolve; the Schweitzer et al. entry had the wrong title, journal and pages).
  • UCTE removed from the list of export formats: pypowsybl's writer needs UCTE node codes and fails on synthetic grids.
  • Docs and notebooks link to mshyang/GridStudio; the instruction to pip install powergridsynth (no such package) is gone; broken :doc: references fixed.
  • Licence is Apache-2.0 with a LICENSE file. The README said MIT and there was no licence file.
  • Version is read from powergrid_synth.__version__ (now 0.2.0); readme.md renamed README.md so built packages get a long description on case-sensitive file systems.
  • docs/_build/ and output/ are no longer tracked.
  • CHANGELOG.md added.

Verification

  • Full install: 308 tests pass, 1 expected failure. Core-only install (no [export]): 214 pass, 5 skipped.
  • All Python blocks in README.md and docs/README.md were executed.
  • 11 example notebooks were executed end to end in a scratch copy.
  • Sphinx build succeeds (warnings 124 to 109; the rest predate this branch).
  • Built wheel and sdist carry License-Expression: Apache-2.0 and the LICENSE file.

Not done, for the reviewer to weigh

  • Not executed: pegase9241_test, rte7k_from_source_file (and their Colab copies) and the grid2graph notebook. Their only edits are URLs and the class rename.
  • AC power flow is unchanged. On 20 IEEE-118 clones, DC converged 20 of 20 and AC 12 of 20. The README now says convergence is not guaranteed; nothing was done to improve it.
  • Attribution is left open. LICENSE is the unmodified Apache text with no copyright line and there is no NOTICE; authors is not set in pyproject.toml. The package description no longer says it is maintained by the AI Energy Lab at TU Delft, while the docs home page still mentions LF Energy and AI-EFFECT.
  • synthesize() still writes output/synthetic_grid.json by default.
  • demos/ is listed in .gitignore but tracked; the RTE and grid2graph notebooks are 10 to 20 MB each. Neither is touched here.

🤖 Generated with Claude Code

mshyang and others added 3 commits November 11, 2026 14:31
…ADME.md

docs/_build/ (70 files of Sphinx HTML) and output/ were committed even
though they are build products; they are now untracked and output/ is
ignored. The files stay on disk.

readme.md is renamed to README.md because pyproject.toml points at
README.md, so packages built on a case-sensitive file system had an
empty long description. The content is unchanged in this commit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ty control

Step-by-step use of the transmission pipeline silently produced a grid
with no generators and no loads unless the caller copied each stage's
result onto the graph by hand. The stages now do that themselves:

- BusTypeAllocator.allocate(), CapacityAllocator.allocate(),
  LoadAllocator.allocate() / allocate_reactive() and
  GenerationDispatcher.dispatch() write bus_type, pg_max, pl, ql and pg
  to the graph as well as returning them (update_graph=False keeps the
  old return-only behaviour).
- A stage that needs an attribute no node has raises a ValueError naming
  the stage to run first, instead of returning an empty result.

Distribution feeders overshot the requested totals because negative
shares were redrawn without renormalising (median 1.7x the requested
load at 200 nodes). Shares are now rescaled so loads sum to
total_load_mw and generation to total_gen_mw; match_totals=False gives
the earlier values. Topology for a given seed is unchanged.

Progress messages go through the "powergrid_synth" logger instead of
print. synthesize() and synthesize_distribution() take verbose=False,
and powergrid_synth.set_verbosity() sets the level for the package.

Also:
- Unknown export formats and a missing pandapower are reported before
  the pipeline runs, not after.
- synthesize(export_formats=None) writes no files.
- Reference mode stores base_kv_map on the graph so a later export
  matches the one synthesize() makes.
- Missing-dependency errors give an install command that works (the
  package is not on PyPI).
- SchweetzerFeederGenerator is renamed SchweitzerFeederGenerator; the
  old name still works with a DeprecationWarning.
- __version__ is 0.2.0.

tests/test_usability.py covers the new behaviour (28 tests).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…licence

README: rewritten around a working install command, a description of
the attributes on the returned graphs, and step-by-step examples that
produce a complete grid. UCTE is dropped from the export formats
(pypowsybl's writer needs UCTE node codes and fails on synthetic
grids), AC power-flow convergence is stated as not guaranteed, and the
two references with non-resolving DOIs / wrong journal are corrected.

Docs: titles, links and Colab URLs point at mshyang/GridStudio; the
non-existent `pip install powergridsynth` is removed; broken :doc:
references and a stale autodoc entry are fixed.

Examples: repository URLs and the renamed feeder generator class are
updated in the notebooks; nothing else in them changes.

Packaging: licence is Apache-2.0 with a LICENSE file (the README said
MIT with no file to back it); the version is read from
powergrid_synth.__version__; the [export] extra gains xlsxwriter and
openpyxl, without which Excel export failed; project URLs, keywords and
classifiers are filled in. The import and distribution name stay
powergrid_synth.

CI: checkout and setup-python actions moved to current major versions.

CHANGELOG.md records the 0.2.0 changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@mshyang
mshyang merged commit 54bfdb3 into main Nov 12, 2026
4 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.

1 participant