Update the component graph to v0.5.0#111
Merged
Merged
Conversation
dev-pytest pulled only the cli extra, so matplotlib and networkx were missing. mypy could not find the matplotlib stubs and failed on _render_graph.py, and pytest skipped tests/test_render_graph.py, so its 11 tests never ran. Pull the render-graph extra instead, which already includes cli. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
v0.5.0 flips the default of prefer_meters_in_component_formulas to False, so the per-category formulas now read the component first and use the meter as the fallback. We take the new default, which changes the per-category formulas in the generated config. The test graph only has a solar inverter, so the pinned pv formulas flip their expected order. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
The graph was built with no ComponentGraphConfig, so callers had no way to change the source order or any other graph setting. In particular they could not keep the meter-first per-category formulas that v0.5.0 of the component graph library moved away from. Take an optional config in ComponentGraphGenerator and thread it through load_configs_from_api and load_configs. Re-export ComponentGraphConfig and FormulaOverrides from frequenz.gridpool and frequenz.gridpool.config so callers do not have to import them from the library. load_configs raises when the config is given without an assets_client, the same way it already does for microgrid_ids, so a config that could never be applied is an error rather than a silent no-op. The default is unchanged: with no config the library's own defaults apply. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
The config knob was only reachable from Python, but generate-config is the tool that regenerates stored configs. An operator who wanted to keep the meter-first order had to write a script instead. The generate-config and print-formulas commands now take --prefer-meters-in-component-formulas, which builds a ComponentGraphConfig with prefer_meters_in_component_formulas set. Without the flag no config is passed, so the defaults still apply. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
shsms
requested review from
Linus404 and
ela-kotulska-frequenz
and removed request for
a team
July 20, 2026 14:59
shsms
force-pushed
the
update-component-graph-0.5
branch
2 times, most recently
from
July 20, 2026 15:08
8a280d4 to
8d3027b
Compare
cwasicki
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The component graph library v0.5.0 changes the default source order of the
per-category formulas, and gridpool offered no way to configure the graph.
This branch takes the update and exposes the graph configuration.
Changes
frequenz-microgrid-component-graphto v0.5.0. The per-categoryformulas (
pv,battery,chp,ev) now read the component first andfall back to the meter, which changes the generated config.
load_configsandload_configs_from_apitake acomponent_graph_configargument, and
ComponentGraphGeneratortakes it asconfig;ComponentGraphConfigandFormulaOverridesare re-exported.generate-configandprint-formulastake a--prefer-meters-in-component-formulasflag to keep the old meter-firstorder.
dev-pytestextra to pullrender-graph, so mypy and the 11render-graph tests actually run.
Breaking
stored configs and review the diff, or pass
ComponentGraphConfig(prefer_meters_in_component_formulas=True)/--prefer-meters-in-component-formulasto keep the old order.