Skip to content

Commit 3743e71

Browse files
authored
Merge pull request #625 from rte-france/dev_1.10.3
Ready for version 1.10.3
2 parents 181383a + 4b36a04 commit 3743e71

File tree

164 files changed

+6947
-2897
lines changed

Some content is hidden

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

164 files changed

+6947
-2897
lines changed

.circleci/config.yml

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
- run:
141141
command: |
142142
source venv_test/bin/activate
143-
python -m pip install -U "numpy>=1.20,<1.21" "pandas<2.2" "scipy<1.12" numba .[test]
143+
python -m pip install -U "numpy>=1.20,<1.21" "pandas<2.2" "scipy<1.12" numba "pillow<10.4.0" .[test]
144144
pip freeze
145145
- run:
146146
command: |
@@ -151,7 +151,7 @@ jobs:
151151
- run:
152152
command: |
153153
source venv_test/bin/activate
154-
python -m pip install -U "numpy>=1.24,<1.25" "pandas<2.2" "scipy<1.12" numba .[test]
154+
python -m pip install -U "numpy>=1.24,<1.25" "pandas<2.2" "scipy<1.12" numba "pillow<10.4.0" .[test]
155155
- run:
156156
command: |
157157
source venv_test/bin/activate
@@ -163,7 +163,7 @@ jobs:
163163
cd /tmp
164164
grid2op.testinstall
165165
166-
legacy_lightsim:
166+
legacy_lightsim_old_pp:
167167
executor: python38 # needs to be 38: whl of lightsim were not released for 3.10 at the time
168168
resource_class: small
169169
steps:
@@ -190,6 +190,59 @@ jobs:
190190
export _GRID2OP_FORCE_TEST=1
191191
python -m unittest grid2op/tests/test_basic_env_ls.py
192192
193+
legacy_lightsim:
194+
executor: python38 # needs to be 38: whl of lightsim were not released for 3.10 at the time
195+
resource_class: small
196+
steps:
197+
- checkout
198+
- run:
199+
command: |
200+
apt-get update
201+
apt-get install -y coinor-cbc
202+
- run: python -m pip install virtualenv
203+
- run: python -m virtualenv venv_test
204+
- run:
205+
command: |
206+
source venv_test/bin/activate
207+
python -m pip install -U pip setuptools wheel
208+
python -m pip install -U lightsim2grid==0.6.0 gymnasium "numpy<1.22"
209+
- run:
210+
command: |
211+
source venv_test/bin/activate
212+
python -m pip install -e .
213+
pip freeze
214+
- run:
215+
command: |
216+
source venv_test/bin/activate
217+
export _GRID2OP_FORCE_TEST=1
218+
python -m unittest grid2op/tests/test_basic_env_ls.py
219+
220+
test_chronix2grid:
221+
executor: python310 # needs to be 38: whl of lightsim were not released for 3.10 at the time
222+
resource_class: small
223+
steps:
224+
- checkout
225+
- run:
226+
command: |
227+
apt-get update
228+
apt-get install -y coinor-cbc
229+
- run: python -m pip install virtualenv
230+
- run: python -m virtualenv venv_test
231+
- run:
232+
command: |
233+
source venv_test/bin/activate
234+
python -m pip install -U pip setuptools wheel "numpy==1.26.4"
235+
- run:
236+
command: |
237+
source venv_test/bin/activate
238+
python -m pip install -e .[chronix2grid] "linopy==0.3.8" "scs==3.2.4.post1" "ecos==2.0.13" "pillow==10.3.0" "numpy==1.26.4" "xarray==2024.3.0"
239+
pip freeze
240+
- run:
241+
command: |
242+
source venv_test/bin/activate
243+
export _GRID2OP_FORCE_TEST=1
244+
python -m unittest grid2op/tests/fromChronix2grid.py
245+
193246
install39:
194247
executor: python39
195248
resource_class: small
@@ -205,8 +258,7 @@ jobs:
205258
command: |
206259
export _GRID2OP_FORCE_TEST=1
207260
source venv_test/bin/activate
208-
python -m pip install -U pip setuptools wheel "numpy>=1.20,<1.21" "pandas<2.2" "scipy==1.10.1" numba
209-
python -m pip install "chronix2grid>=1.1.0.post1" "gymnasium==0.26.3" "matplotlib==3.7.5" "xarray==2023.10.0" "scs==3.0.0" "ecos==2.0.0"
261+
python -m pip install -U pip setuptools wheel "numpy>=1.20,<1.21" "pandas<2.2" "scipy==1.10.1" "pillow<10.4.0" numba
210262
python -m pip uninstall -y grid2op
211263
- run:
212264
command: | # issue with previous more simple install, so I fix some versions
@@ -222,7 +274,7 @@ jobs:
222274
- run:
223275
command: |
224276
source venv_test/bin/activate
225-
python -m pip install "numpy>=1.26,<1.27" "pandas<2.2" "scipy<1.12" numba
277+
python -m pip install "numpy>=1.26,<1.27" "pandas<2.2" "scipy<1.12" numba "pillow<10.4.0"
226278
pip freeze
227279
- run:
228280
command: |
@@ -340,7 +392,10 @@ workflows:
340392
test:
341393
jobs:
342394
- test
395+
- legacy_lightsim_old_pp
343396
- legacy_lightsim
397+
- test_chronix2grid
398+
344399
install:
345400
jobs:
346401
- install38

.github/workflows/main.yml

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
name: Build linux ${{ matrix.python.name }} wheel
1313
runs-on: ubuntu-latest
1414
container: quay.io/pypa/manylinux2014_x86_64
15+
env:
16+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1517
strategy:
1618
matrix:
1719
python:
@@ -59,7 +61,7 @@ jobs:
5961
6062
- name: Build wheel
6163
run: |
62-
python3 setup.py bdist_wheel
64+
python setup.py bdist_wheel
6365
# auditwheel repair dist/*.whl # only for compiled code !
6466
6567
- name: Install wheel
@@ -69,12 +71,16 @@ jobs:
6971
7072
- name: Check package can be imported
7173
run: |
72-
python3 -c "import grid2op"
73-
python3 -c "from grid2op import *"
74-
python3 -c "from grid2op.Action._backendAction import _BackendAction"
75-
74+
python -c "import grid2op"
75+
python -c "from grid2op import *"
76+
python -c "from grid2op.Action._backendAction import _BackendAction"
77+
78+
- name: List wheel
79+
run:
80+
ls ./dist/*.whl
81+
7682
- name: Upload wheel
77-
uses: actions/upload-artifact@v2
83+
uses: actions/upload-artifact@v3
7884
with:
7985
name: grid2op-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
8086
path: dist/*.whl
@@ -165,10 +171,70 @@ jobs:
165171
name: grid2op-sources
166172
path: dist/*.tar.gz
167173

174+
auto_class_in_file:
175+
name: Test ${{ matrix.config.name }} OS can handle automatic class generation
176+
runs-on: ${{ matrix.config.os }}
177+
strategy:
178+
matrix:
179+
config:
180+
- {
181+
name: darwin,
182+
os: macos-latest,
183+
}
184+
# - {
185+
# name: windows,
186+
# os: windows-2019,
187+
# }
188+
- {
189+
name: ubuntu,
190+
os: ubuntu-latest,
191+
}
192+
python:
193+
- {
194+
name: cp39,
195+
version: '3.9',
196+
}
197+
- {
198+
name: cp312,
199+
version: '3.12',
200+
}
201+
202+
steps:
203+
204+
- name: Checkout sources
205+
uses: actions/checkout@v1
206+
with:
207+
submodules: true
208+
209+
- name: Setup Python
210+
uses: actions/setup-python@v2
211+
with:
212+
python-version: ${{ matrix.python.version }}
213+
214+
- name: Install Python dependencies
215+
run: |
216+
python -m pip install --upgrade pip
217+
python -m pip install --upgrade wheel
218+
python -m pip install --upgrade setuptools
219+
python -m pip install --upgrade gymnasium "numpy<2"
220+
221+
- name: Build wheel
222+
run: python setup.py bdist_wheel
223+
224+
- name: Install wheel
225+
shell: bash
226+
run: |
227+
python -m pip install dist/*.whl --user
228+
pip freeze
229+
230+
- name: Test the automatic generation of classes in the env folder
231+
run: |
232+
python -m unittest grid2op/tests/automatic_classes.py -f
233+
168234
package:
169235
name: Test install
170236
runs-on: ubuntu-latest
171-
needs: [manylinux_build, macos_windows_build]
237+
needs: [manylinux_build, macos_windows_build, auto_class_in_file]
172238

173239
steps:
174240
- name: Download wheels

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,12 @@ grid2op/tests/req_38_np121
410410
test_make_2_envs.py
411411
getting_started/env_py38_grid2op110_ray110.ipynb
412412
getting_started/env_py38_grid2op110_ray210.ipynb
413+
grid2op/tests/req_chronix2grid
414+
grid2op/tests/venv_test_chronix2grid/
415+
getting_started/venv_310_ray/
416+
grid2op/tests/venv_test_autoclass/
417+
test_eduardo.py
418+
grid2op/tests/failed_test*
413419

414420
# profiling files
415421
**.prof

CHANGELOG.rst

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,113 @@ Change Log
3131
- [???] "asynch" multienv
3232
- [???] properly model interconnecting powerlines
3333

34+
Work kind of in progress
35+
----------------------------------
36+
- TODO A number of max buses per sub
37+
- TODO in the runner, save multiple times the same sceanrio
38+
- TODO in the gym env, make the action_space and observation_space attribute
39+
filled automatically (see ray integration, it's boring to have to copy paste...)
40+
41+
Next release
42+
---------------------------------
43+
- numpy 2 compat (need pandapower for that)
44+
- automatic read from local dir also on windows !
45+
- TODO doc for the "new" feature of automatic "experimental_read_from_local_dir"
46+
- TODO bug on maintenance starting at midnight (they are not correctly handled in the observation)
47+
=> cf script test_issue_616
48+
- TODO put the Grid2opEnvWrapper directly in grid2op as GymEnv
49+
- TODO faster gym_compat (especially for DiscreteActSpace and BoxGymObsSpace)
50+
- TODO Notebook for tf_agents
51+
- TODO Notebook for acme
52+
- TODO Notebook using "keras rl" (see https://keras.io/examples/rl/ppo_cartpole/)
53+
- TODO example for MCTS https://github.com/bwfbowen/muax et https://github.com/google-deepmind/mctx
54+
- TODO jax everything that can be: create a simple env based on jax for topology manipulation, without
55+
redispatching or rules
56+
- TODO backend in jax, maybe ?
57+
- TODO done and truncated properly handled in gym_compat module (when game over
58+
before the end it's probably truncated and not done)
59+
- TODO when reset, have an attribute "reset_infos" with some infos about the
60+
way reset was called.
61+
- TODO ForecastEnv in MaskedEnv ! (and obs.simulate there too !)
62+
- TODO finish the test in automatic_classes
63+
- TODO in multi-mix increase the reset options with the mix the user wants
64+
- TODO L2RPN scores as reward (sum loads after the game over and have it in the final reward)
65+
- TODO on CI: test only gym, only gymnasium and keep current test for both gym and gymnasium
66+
67+
[1.10.3] - 2024-07-yy
68+
-------------------------
69+
- TODO Automatic "experimental_read_from_local_dir"
70+
71+
- [BREAKING] `env.chronics_hander.set_max_iter(xxx)` is now a private function. Use
72+
`env.set_max_iter(xxx)` or even better `env.reset(options={"max step": xxx})`.
73+
Indeed, `env.chronics_hander.set_max_iter()` will likely have
74+
no effect at all on your environment.
75+
- [BREAKING] for all the `Handler` (*eg* `CSVForecastHandler`) the method `set_max_iter` is
76+
now private (for the same reason as the `env.chronics_handler`). We do not recommend to
77+
use it (will likely have no effect). Prefer using `env.set_max_iter` instead.
78+
- [BREAKING] now the `runner.run()` method only accept kwargs argument
79+
(because it should always have been like this)
80+
- [BREAKING] to improve pickle support and multi processing capabilities, the attribute
81+
`gym_env.observation_space._init_env` and `gym_env.observation_space.initial_obs_space`
82+
have been deleted (for the `Dict` space only, for the other spaces like the `Box` they
83+
were not present in the first place)
84+
- [BREAKING] in the `GymEnv` class now by default the underlying grid2op environment has no
85+
forecast anymore in an attempt to make this wrapper faster AND more easily pickle-able. You can
86+
retrieve the old behaviour by passing `gym_env = GymEnv(grid2op_env, with_forecast=True)`
87+
- [FIXED] a bug in the `MultiFolder` and `MultifolderWithCache` leading to the wrong
88+
computation of `max_iter` on some corner cases
89+
- [FIXED] the function `cleanup_action_space()` did not work correctly when the "chronics_hander"
90+
was not initialized for some classes
91+
- [FIXED] the `_observationClass` attribute of the "observation env" (used for simulate and forecasted env)
92+
is now an Observation and not an Action.
93+
- [FIXED] a bug when deep copying an "observation environment" (it changes its class)
94+
- [FIXED] issue on `seed` and `MultifolderWithCache` which caused
95+
https://github.com/rte-france/Grid2Op/issues/616
96+
- [FIXED] another issue with the seeding of `MultifolderWithCache`: the seed was not used
97+
correctly on the cache data when calling `chronics_handler.reset` multiple times without
98+
any changes
99+
- [FIXED] `Backend` now properly raise EnvError (grid2op exception) instead of previously
100+
`EnvironmentError` (python default exception)
101+
- [FIXED] a bug in `PandaPowerBackend` (missing attribute) causing directly
102+
https://github.com/rte-france/Grid2Op/issues/617
103+
- [FIXED] a bug in `Environment`: the thermal limit were used when loading the environment
104+
even before the "time series" are applied (and before the user defined thermal limits were set)
105+
which could lead to disconnected powerlines even before the initial step (t=0, when time
106+
series are loaded)
107+
- [FIXED] an issue with the "max_iter" for `FromNPY` time series generator
108+
- [FIXED] a bug in `MultiMixEnvironment` : a multi-mix could be created even if the underlying
109+
powergrids (for each mix) where not the same.
110+
- [FIXED] a bug in `generate_classes` (experimental_read_from_local_dir) with alert data.
111+
- [FIXED] a bug in the `Runner` when using multi processing on macos and windows OS: some non default
112+
parameters where not propagated in the "child" process (bug in `runner._ger_params`)
113+
- [ADDED] possibility to skip some step when calling `env.reset(..., options={"init ts": ...})`
114+
- [ADDED] possibility to limit the duration of an episode with `env.reset(..., options={"max step": ...})`
115+
- [ADDED] possibility to specify the "reset_options" used in `env.reset` when
116+
using the runner with `runner.run(..., reset_options=xxx)`
117+
- [ADDED] the argument `mp_context` when building the runner to help pass a multiprocessing context in the
118+
grid2op `Runner`
119+
- [ADDED] the time series are now able to regenerate their "random" part
120+
even when "cached" thanks to the addition of the `regenerate_with_new_seed` of the
121+
`GridValue` class (in public API)
122+
- [ADDED] `MultifolderWithCache` now supports `FromHandlers` time series generator
123+
- [IMPROVED] more consistency in the way the classes are initialized at the creation of an environment
124+
- [IMPROVED] more consistency when an environment is copied (some attributes of the copied env were
125+
deep copied incorrectly)
126+
- [IMPROVED] Doc about the runner
127+
- [IMPROVED] the documentation on the `time series` folder.
128+
- [IMPROVED] now the "maintenance from json" (*eg* the `JSONMaintenanceHandler` or the
129+
`GridStateFromFileWithForecastsWithMaintenance`) can be customized with the day
130+
of the week where the maintenance happens (key `maintenance_day_of_week`)
131+
- [IMPROVED] in case of "`MultiMixEnvironment`" there is now only class generated for
132+
all the underlying mixes (instead of having one class per mixes)
133+
- [IMPROVED] the `EpisodeData` have now explicitely a mode where they can be shared accross
134+
processes (using `fork` at least), see `ep_data.make_serializable`
135+
- [IMPROVED] chronix2grid tests are now done independantly on the CI
136+
137+
34138
[1.10.2] - 2024-05-27
35139
-------------------------
36-
- [BREAKING] the `runner.run_one_episode` now returns an extra first argument:
140+
- [BREAKING] the `runner.run_one_episode` now returns an extra argument (first position):
37141
`chron_id, chron_name, cum_reward, timestep, max_ts = runner.run_one_episode()` which
38142
is consistant with `runner.run(...)` (previously it returned only
39143
`chron_name, cum_reward, timestep, max_ts = runner.run_one_episode()`)
@@ -822,7 +926,7 @@ Change Log
822926
`Issue#185 <https://github.com/rte-france/Grid2Op/issues/185>`_ )
823927
- [IMPROVED] the seed of openAI gym for composed action space (see issue `https://github.com/openai/gym/issues/2166`):
824928
in waiting for an official fix, grid2op will use the solution proposed there
825-
https://github.com/openai/gym/issues/2166#issuecomment-803984619 )
929+
https://github.com/openai/gym/issues/2166#issuecomment-803984619
826930

827931
[1.5.1] - 2021-04-15
828932
-----------------------

0 commit comments

Comments
 (0)