Skip to content

deprecate create_empty_network#2848

Open
KS-HTK wants to merge 35 commits intoe2nIEE:release/v4.0.0from
KS-HTK:feature/deprecate-create_empty_entwork
Open

deprecate create_empty_network#2848
KS-HTK wants to merge 35 commits intoe2nIEE:release/v4.0.0from
KS-HTK:feature/deprecate-create_empty_entwork

Conversation

@KS-HTK
Copy link
Copy Markdown
Collaborator

@KS-HTK KS-HTK commented Jan 13, 2026

BREAKING CHANGES!

This pull request deprecates the create_empty_network functions and enables its functionality via the pandapowerNet constructor:

pandapowerNet(name='My Network', f_hz=60., sn_mva=1., add_stdtypes=True)

An additional attribute has been introduced custom_data which allows for adding custom attributes to a pandapowerNet at creation.

It is no longer possible to create a network without the default attributes.

refactored pandapowerNet and ADict to avoid circular imports
replaced all calls to create_empty_network
deprecated use of constructor for deepcopy
name is now a required attribute for pandapowerNet
@KS-HTK KS-HTK changed the title deprecate create_empty_entwork deprecate create_empty_network Jan 13, 2026
@furqan463
Copy link
Copy Markdown
Contributor

Why make a breaking change?
Why not make a transition supporting both constructor and create_empty_network?

@KS-HTK
Copy link
Copy Markdown
Collaborator Author

KS-HTK commented Jan 13, 2026

Why make a breaking change? Why not make a transition supporting both constructor and create_empty_network?

The breaking part is that the constructor no longer allows a network without the default tables.
Before it was possible to create a totally empty network (not output of create_empty_network but a pandapowerNet class object that did not contain any dataframes). To get this now would require making a pandapowerNet and dropping all attributes.

net = pandapowerNet(name='')
for key in net:
  del net[key]

We discussed this and are of the opinion that if a object is a pandapowerNet it should at least contain the bus, line, trafo, etc. tables that were created by create_empty_network and it should not be possible to do pandapowerNet({}) and get a object of class pandapowerNet with no content.
If this is the desired behavior a object of type ADict should be created, this will also allow access to keys via the attribute notation.

What is not breaking is the use of create_empty_network. It was replaced with a function that calls pandapowerNet() and passes its parameters, and has also been marked as deprecated.

@KS-HTK KS-HTK added this to the pandapower 4.0 milestone Jan 20, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 85.51532% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.20%. Comparing base (e7c3444) to head (7d4fed6).

Files with missing lines Patch % Lines
pandapower/network.py 84.45% 23 Missing ⚠️
pandapower/plotting/patch_makers.py 44.44% 5 Missing ⚠️
pandapower/estimation/algorithm/base.py 20.00% 4 Missing ⚠️
pandapower/protection/example_grids.py 0.00% 4 Missing ⚠️
pandapower/convert_format.py 76.92% 3 Missing ⚠️
pandapower/estimation/algorithm/matrix_base.py 66.66% 2 Missing ⚠️
pandapower/toolbox/element_selection.py 50.00% 2 Missing ⚠️
pandapower/converter/cim/cim2pp/build_pp_net.py 80.00% 1 Missing ⚠️
pandapower/converter/cim/pp_classes.py 0.00% 1 Missing ⚠️
...ower/converter/powerfactory/pp_import_functions.py 88.88% 1 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2848      +/-   ##
===========================================
- Coverage    72.26%   72.20%   -0.07%     
===========================================
  Files          351      352       +1     
  Lines        37967    37941      -26     
===========================================
- Hits         27438    27396      -42     
- Misses       10529    10545      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	pandapower/auxiliary.py
#	pandapower/groups.py
#	pandapower/test/api/test_group.py
#	pandapower/test/conftest.py
#	pandapower/test/loadflow/test_facts_b2b_vsc.py
#	pandapower/test/loadflow/test_facts_vsc.py
#	pandapower/test/loadflow/test_rundcpp.py
#	pandapower/test/loadflow/test_runpp_3ph_n_line.py
#	pandapower/test/toolbox/test_result_info.py
added standard types dict type
fixed all mypy issues
@KS-HTK KS-HTK force-pushed the feature/deprecate-create_empty_entwork branch from 1dc8a6d to c454d51 Compare February 5, 2026 13:36
removed numpy1 warning test as the warning was removed
# Conflicts:
#	pandapower/shortcircuit/calc_sc.py
#	pandapower/test/api/test_create.py
#	pandapower/test/api/test_file_io.py
#	pandapower/test/contingency/test_contingency.py
#	pandapower/test/control/test_stactrl.py
#	pandapower/test/loadflow/result_test_network_generator.py
#	pandapower/test/loadflow/test_facts_b2b_vsc.py
#	pandapower/test/loadflow/test_facts_vsc.py
#	pandapower/test/loadflow/test_recycle.py
#	pandapower/test/loadflow/test_results.py
#	pandapower/test/loadflow/test_runpp.py
#	pandapower/test/loadflow/test_runpp_3ph.py
#	pandapower/test/loadflow/test_runpp_3ph_n_line.py
#	pandapower/test/loadflow/test_scenarios.py
#	pandapower/test/networks/test_kerber_networks.py
#	pandapower/test/opf/test_basic.py
#	pandapower/test/opf/test_check_opf_data.py
#	pandapower/test/opf/test_pandamodels_runpm.py
#	pandapower/test/toolbox/test_grid_modification.py
@sonarqubecloud
Copy link
Copy Markdown

KS-HTK added 6 commits March 23, 2026 15:29
# Conflicts:
#	pandapower/diagnostic/diagnostic_functions.py
#	pandapower/estimation/algorithm/base.py
#	pandapower/estimation/algorithm/matrix_base.py
#	pandapower/groups.py
#	pandapower/plotting/collections.py
#	pandapower/test/api/test_auxiliary.py
#	pandapower/test/control/test_continuous_tap_control.py
#	pandapower/test/control/test_stactrl.py
#	pandapower/test/grid_equivalents/test_get_equivalent.py
#	pandapower/test/loadflow/test_runpp_3ph.py
#	pandapower/toolbox/data_modification.py
#	pandapower/toolbox/grid_modification.py
@KS-HTK KS-HTK changed the base branch from develop to release/v4.0.0 March 24, 2026 09:14
@sonarqubecloud
Copy link
Copy Markdown

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.

3 participants