Skip to content

Commit 80f7fda

Browse files
authored
Merge pull request #702 from Grid2op/dev_1.11.0
Dev 1.11.0
2 parents 8339ca9 + ad85fa4 commit 80f7fda

File tree

147 files changed

+10258
-3593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+10258
-3593
lines changed

.circleci/config.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ jobs:
3939
- run:
4040
command: |
4141
source venv_test/bin/activate
42-
pip install -U pip setuptools wheel
42+
pip install -U pip setuptools wheel coverage
4343
- run:
4444
command: |
4545
source venv_test/bin/activate
4646
pip install -e .[test]
4747
export _GRID2OP_FORCE_TEST=1
4848
cd grid2op/tests/
49-
python3 helper_list_test.py | circleci tests split > /tmp/tests_run
49+
python3 helper_list_test.py > li_test
50+
cat li_test | circleci tests split > /tmp/tests_run
5051
- run:
5152
command: |
5253
source venv_test/bin/activate
@@ -57,8 +58,42 @@ jobs:
5758
source venv_test/bin/activate
5859
cd grid2op/tests/
5960
export _GRID2OP_FORCE_TEST=1
60-
python3 -m unittest -v $(cat /tmp/tests_run)
61-
61+
coverage run -m unittest -v $(cat /tmp/tests_run)
62+
# ls -lah | grep .coverage
63+
# - run:
64+
# command: |
65+
# ls -lah /Grid2Op/grid2op/tests/.coverage.*
66+
67+
# - store_artifacts:
68+
# path: "/Grid2Op/grid2op/tests/test_Action.py"
69+
# destination: coverage_artifacts/
70+
71+
gen_coverage:
72+
executor: grid2op-executor
73+
resource_class: small
74+
steps:
75+
- checkout
76+
- run: python -m pip install virtualenv
77+
- run: python -m virtualenv venv_test
78+
- run:
79+
command: |
80+
source venv_test/bin/activate
81+
pip install -U pip setuptools wheel coverage
82+
- run:
83+
command: |
84+
source venv_test/bin/activate
85+
cd grid2op/tests/
86+
coverage combine ../../coverage_artifacts/ --keep
87+
coverage report -m -i
88+
coverage html -i
89+
coverage xml -i
90+
- store_artifacts:
91+
path: grid2op/tests/htmlcov
92+
destination: htmlcov
93+
- store_artifacts:
94+
path: grid2op/tests/coverage.xml
95+
destination: coverage.xml
96+
6297
install36:
6398
executor: python36
6499
resource_class: small
@@ -403,3 +438,19 @@ workflows:
403438
- install310
404439
- install311
405440
- install312
441+
442+
# gather_test_report:
443+
# requires:
444+
# - test
445+
# jobs:
446+
# - gen_coverage
447+
448+
# send_tests_report:
449+
# requires:
450+
# - gather_test_report
451+
# orbs:
452+
# coverage-reporter: codacy/[email protected]
453+
# jobs:
454+
# coverage-reporter/send_report:
455+
# coverage-reports: coverage.xml
456+
# project-token: $CODACY_PROJECT_TOKEN

.github/workflows/main.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jobs:
6868
- name: Build wheel
6969
run: |
7070
python setup.py bdist_wheel
71-
# auditwheel repair dist/*.whl # only for compiled code !
7271
7372
- name: Install wheel
7473
run: |
@@ -80,7 +79,23 @@ jobs:
8079
python -c "import grid2op"
8180
python -c "from grid2op import *"
8281
python -c "from grid2op.Action._backendAction import _BackendAction"
82+
83+
# - name: Run full tests + code coverage
84+
# if: matrix.python.name == 'cp312'
85+
# run: |
86+
# python -m pip install --upgrade coverage
87+
# python -m pip install --find-links=dist/ grid2op[test]
88+
# cd grid2op/tests
89+
# coverage run -m unittest discover
90+
# coverage xml -i
8391

92+
# - name: Upload coverage
93+
# if: matrix.python.name == 'cp312'
94+
# uses: actions/upload-artifact@v4
95+
# with:
96+
# name: coverage.xml
97+
# path: grid2op/tests/*.xml
98+
8499
- name: List wheel
85100
run:
86101
ls ./dist/*.whl

CHANGELOG.rst

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Work "in progress"
33

44
General grid2op improvments:
55

6+
- ill formed docstring in the BaseAction module
67
- remove pandapower dependency (have a way to install grid2op without pandapower)
78
- better logging
89
- have functions that automatically computes topo_vect and switch_state in the backend
@@ -23,6 +24,8 @@ General grid2op improvments:
2324
- in parallel distribute the loading of the time series if using a `MultifolderWithCache`
2425
- Code and test the "load from disk" method
2526
- add a "plot action" method
27+
- does not read every data of the backend if not used
28+
- backend converter: now test it properly with pandapower / lightsim2grid and pypowsybl2grid
2629

2730
Better multi processing support:
2831

@@ -94,6 +97,128 @@ Native multi agents support:
9497

9598
- cf ad-hoc branch (dev-multiagents)
9699
- properly model interconnecting powerlines
100+
- add detachment
101+
- add change_bus / set_bus
102+
103+
[1.11.0] - 2025-04-14
104+
-----------------------
105+
- [BREAKING] Change for `FromMultiEpisodeData` that disables the caching by default
106+
when creating the data.
107+
- [BREAKING] deprecation of `backend.check_kirchoff` in favor of `backend.check_kirchhoff`
108+
(fix the typo in the name)
109+
- [BREAKING] change the name of the generated classes: now by default the backend class
110+
name is added. This behaviour can be turned off by passing `_add_cls_nm_bk=False`
111+
when calling `grid2op.make(...)`. If you develop a new Backend, you can also
112+
customize the added name by overloading the `get_class_added_name` class method.
113+
- [BREAKING] it is now forbidden to create environment with arguments.
114+
Only key-word arguments are allowed.
115+
- [BREAKING] the way actions is serialized has been changed with respect to the `from_vect` /
116+
`to_vect` method. This might introduce some issues when loading previously saved actions
117+
with this methods.
118+
- [BREAKING] first kwargs of `backend.apply_action` method is now spelled `backend_action`
119+
(instead of backendAction)
120+
- [BREAKING] (not yet) rationalization of the backend public / private API part. The
121+
environment (and simulator, forecast env etc.) will always call the method `_public`
122+
for example `load_grid_public`, `reset_public`, `copy_public` and `apply_action_public`.
123+
These function of the base `Backend` should NOT be overriden, and will internally call
124+
the functions `load_grid`, `reset`, `copy` and `apply_action` which were part of the public
125+
API. These last member functions will be renamed (in a later version) `_load_grid`,
126+
`_reset`, `_copy` and `_apply_action` to reflect this change. NOT for this version however !
127+
- [BREAKING] removal of the `rest_server` grid2op module (it will be release as a separate package instead)
128+
It has been removed from grid2op core package for securtiy reasons.
129+
- [FIXED] issue https://github.com/Grid2op/grid2op/issues/657
130+
- [FIXED] missing an import on the `MaskedEnvironment` class
131+
- [FIXED] a bug when trying to set the load_p, load_q, gen_p, gen_v by names.
132+
- [FIXED] the `obs.get_forecast_env` : in some cases the resulting first
133+
observation (obtained from `for_env.reset()`) did not have the correct
134+
topology.
135+
- [FIXED] issue https://github.com/Grid2op/grid2op/issues/665 (`obs.reset()`
136+
was not correctly implemented: some attributes were forgotten)
137+
- [FIXED] issue https://github.com/Grid2op/grid2op/issues/667 (`act.as_serializable_dict()`
138+
was not correctly implemented AND the `_aux_affect_object_int` and `_aux_affect_object_float`
139+
have been also fixed - weird behaviour when you give them a list with the exact length of the
140+
object you tried to modified (for example a list with a size of `n_load` that affected the loads))
141+
- [FIXED] a bug when using the `DoNothingHandler` for the maintenance and the
142+
environment data
143+
- [FIXED] an issue preventing to set the thermal limit in the options
144+
if the last simulated action lead to a game over
145+
- [FIXED] some bugs in `act.from_json(...)` due to the handling of the injection modifications.
146+
- [FIXED] logos now have the correct URL
147+
- [FIXED] deprecated call to `tostring_rgb` (replaced `tostring_argb`) in the env.render function.
148+
- [FIXED] warnings not properly issued in the AAA test when backend failed to call
149+
`can_handle_XXX` functions (*eg* `can_handle_more_than_2_busbar()` or `can_handle_detachment()`)
150+
- [FIXED] an issue with `obs.get_forecast_env` with changeNothing and DoNothingHandler time series
151+
- [FIXED] a bug in updating the shunt in PandaPowerBackend (depdending on pandas version)
152+
- [FIXED] a bug when action that reconnect loads, storage units or shunts are done
153+
in the "obs.simulate" (results could depend from previous "obs.simulate" calls)
154+
- [FIXED] a bug in "obs.simulate" and "obs.get_forecast_env" : when a line was disconnected
155+
and the user tried to reconnect it (without specifying on which bus) it could do something
156+
different than "env.step" (with the same action)
157+
- [FIXED] a powerflow is run when the environment is first created even before the initial "env.step"
158+
function is called. This is to ensure proper behaviour if env is used without being reset.
159+
- [FIXED] no error was catched if the backend could not properly apply the action sent by the environment.
160+
- [FIXED] an issue in the AAA tests: when backend does not support storages, some tests were skipped not correctly
161+
- [FIXED] an issue when computing the cascading failure routine, in case multiple iterations were performed,
162+
the cooldowns were not updated correctly.
163+
- [FIXED] cascading failure could be started at the first observation (t=0, just after a reset).
164+
- [FIXED] a bug when "SOFT_OVERFLOW_THRESHOLD" was not 1.: it also impacted "instantaneous overcurrent protections"
165+
(it was triggered when `flow > SOFT_OVERFLOW_THRESHOLD * HARD_OVERFLOW_THRESHOLD * th_lim`)
166+
- [FIXED] a bug when "SOFT_OVERFLOW_THRESHOLD" was not 1.: the backend routine to compute the protections
167+
disconnected the lines with a counter based on `flow > th_lim` and not `flow > th_lim * SOFT_OVERFLOW_THRESHOLD`
168+
- [ADDED] Possibility to disconnect loads, generators and storage units (if proper flag set in the environment).
169+
See documentation.
170+
- [ADDED] possibility to set the "thermal limits" when calling `env.reset(..., options={"thermal limit": xxx})`
171+
- [ADDED] possibility to retrieve some structural information about elements with
172+
with `gridobj.get_line_info(...)`, `gridobj.get_load_info(...)`, `gridobj.get_gen_info(...)`
173+
or , `gridobj.get_storage_info(...)`
174+
- [ADDED] codacy badge on the readme
175+
- [ADDED] a method to check the KCL (`obs.check_kirchhoff`) directly from the observation
176+
(previously it was only possible to do it from the backend). This should
177+
be used for testing purpose only
178+
- [ADDED] parameters to disable the "redispatching routine" of the environment
179+
(see `params.ENV_DOES_REDISPATCHING`)
180+
- [ADDED] parameters to stop the episode when one of the constraints of one of the
181+
generators is not met (see `params.STOP_EP_IF_SLACK_BREAK_CONSTRAINTS`)
182+
- [ADDED] possibility to set the initial time stamp of the observation in the `env.reset`
183+
kwargs by using `env.reset(..., options={"init datetime": XXX})`
184+
- [ADDED] the `ChangeNothing` time series class now supports forecast
185+
- [ADDED] test coverage on the CI
186+
- [ADDED] the `obs.timestep_protection_triggered` counter which counts whether or not the
187+
"time overcurrent protection" (soft overflow) will be triggered: lines will be disconnected
188+
if `time overcurrent protection > parameters.NB_TIMESTEP_POWERFLOW_ALLOWED`
189+
- [IMPROVED] possibility to set the injections values with names
190+
to be consistent with other way to set the actions (*eg* set_bus)
191+
- [IMPROVED] error messages when creating an action which changes the injections
192+
- [IMPROVED] (linked to https://github.com/Grid2op/grid2op/issues/657) the way the
193+
"chronics_hander" in the ObsEnv behaves (it now fully implements the public interface of
194+
a "real" chronic_handler)
195+
- [IMPROVED] error message in the `FromNPY` class when the backend is checked
196+
- [IMRPOVED] the `FromMultiEpisodeData` class with the addition of the `caching`
197+
kwargs to allow / disable caching (which was default behavior in previous version)
198+
- [IMPROVED] the `FromMultiEpisodeData` class that now returns also the path of the data
199+
- [IMPROVED] the classes inherited from `GreedyAgent` with the added possibility to
200+
do the `obs.simulate` on a different time horizon (kwarg `simulated_time_step`)
201+
- [IMPROVED] some type hints for some agent class
202+
- [IMPROVED] the `backend.update_from_obs` function to work even when observation
203+
does not have shunt information but there are not shunts on the grid.
204+
- [IMPROVED] consistency of `MultiMixEnv` in case of automatic_classes (only one
205+
class is generated for all mixes)
206+
- [IMRPOVED] handling of disconnected elements in the backend no more
207+
raise error. The base `Backend` class does that.
208+
- [IMPROVED] the `act.as_serializable_dict()` to be more 'backend agnostic'as
209+
it nows tries to use the name of the elements in the json output
210+
- [IMPROVED] the way shunt data are digested in the `BaseAction` class (it is now
211+
possible to use the same things as for the other types of element)
212+
- [IMPROVED] grid2op does not require the `chronics` folder when using the `FromHandlers`
213+
class
214+
- [IMPROVED] the function `action.get_topological_impact(...)` has now a "caching" mechanism
215+
that allows not to recompute it over and over again (this is internal API please do not change
216+
it... unless you know what you are doing)
217+
- [IMPROVED] `ForecastEnv` is now part of the public API.
218+
- [IMPROVED] no need to call `self._compute_pos_big_top()` at the end of the implementation of `backend.load_grid()`
219+
- [IMPROVED] type hints in various files.
220+
- [IMPROVED] documentation of the backend
221+
- [IMRPOVED] `SOFT_OVERFLOW_THRESHOLD` can now be lower than 1
97222

98223
[1.10.5] - 2025-03-07
99224
------------------------

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
[![Downloads](https://pepy.tech/badge/grid2op)](https://pepy.tech/project/grid2op)
44
[![PyPi_Version](https://img.shields.io/pypi/v/grid2op.svg)](https://pypi.org/project/Grid2Op/)
55
[![PyPi_Compat](https://img.shields.io/pypi/pyversions/grid2op.svg)](https://pypi.org/project/Grid2Op/)
6+
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10367/badge)](https://www.bestpractices.dev/projects/10367)
67
[![LICENSE](https://img.shields.io/pypi/l/grid2op.svg)](https://www.mozilla.org/en-US/MPL/2.0/)
78
[![Documentation Status](https://readthedocs.org/projects/grid2op/badge/?version=latest)](https://grid2op.readthedocs.io/en/latest/?badge=latest)
9+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/3a4e666ba20f4f20b9131e9a6081622c)](https://app.codacy.com/gh/Grid2op/grid2op/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
810
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/Grid2op/grid2op/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Grid2op/grid2op/tree/master)
911
[![discord](https://discord.com/api/guilds/698080905209577513/embed.png)](https://discord.gg/cYsYrPT)
1012
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/grid2op/grid2op.git/master)
@@ -200,6 +202,9 @@ interesting part of this framework:
200202
* [11_IntegrationWithExistingRLFrameworks](getting_started/11_IntegrationWithExistingRLFrameworks.ipynb)
201203
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Grid2Op/grid2op/blob/master/getting_started/11_IntegrationWithExistingRLFrameworks.ipynb)
202204
explains how to use grid2op with other reinforcement learning framework. TODO: this needs to be redone
205+
* [12_DetachmentOfLoadsAndGenerators.ipynb](getting_started/12_DetachmentOfLoadsAndGenerators.ipynb.ipynb)
206+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Grid2Op/grid2op/blob/master/getting_started/12_DetachmentOfLoadsAndGenerators.ipynb.ipynb)
207+
explains briefly what is detachment.
203208

204209
Try them out in your own browser without installing
205210
anything with the help of mybinder:

binder/environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies:
88
- pip
99
- pip:
1010
- grid2op
11-
- jyquickhelper
1211
- numpy
1312
- numba
1413
- seaborn

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
author = 'Benjamin Donnot'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.10.5.post1'
26-
version = '1.10'
25+
release = '1.11.0.dev6'
26+
version = '1.11'
2727

2828

2929
# -- General configuration ---------------------------------------------------

0 commit comments

Comments
 (0)