Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3e89dd0
increase version number: 1.12.2.dev0
BDonnot Aug 29, 2025
4ea3163
reduce tar.gz size + include specific test in CI for it
BDonnot Aug 29, 2025
a15b74e
Add: Changes to BaseAction, SerializableActionSpace and GridObjects
DEUCE1957 Sep 15, 2025
ea92029
Add: flexibility_is_available attribute to GridObjects
DEUCE1957 Sep 16, 2025
8dc001b
Add: Flexibility Test Environment
DEUCE1957 Sep 16, 2025
1aba6b5
Add: flexibility does not affect topology
DEUCE1957 Sep 16, 2025
02a7540
Add: Flexibility to BackendAction
DEUCE1957 Sep 16, 2025
e6dea22
Add: Flexibility Attributes to GridObejcts
DEUCE1957 Sep 16, 2025
2387036
Add: Missing Flexibility Attribute Processing in GridObjects
DEUCE1957 Sep 16, 2025
f0564ff
Add: Flexibility Attributes to Observation
DEUCE1957 Sep 16, 2025
facaf6a
Add: Flex in parameters
DEUCE1957 Sep 16, 2025
f451d08
Add: Flexibility in redispatch optimization
DEUCE1957 Sep 16, 2025
fee5fbe
Add: BackendAction updates include flexibility
DEUCE1957 Sep 17, 2025
d2a50e1
Add: load_flexibility_data to Backend
DEUCE1957 Sep 17, 2025
008c8f5
Add: Backend Converter Support for Flexibility
DEUCE1957 Sep 17, 2025
f313f23
Add: load_flexibility_data in test backend
DEUCE1957 Sep 17, 2025
180037f
Add: Flex Defaults in GridObjects and Environment
DEUCE1957 Sep 17, 2025
a45e8d9
Add: Update flexibility test environment
DEUCE1957 Sep 17, 2025
c886a75
Add: Demand Response Notebook
DEUCE1957 Sep 17, 2025
fecef7f
Add: Test on Linux
DEUCE1957 Sep 18, 2025
4cf0d64
Test: Update observation to pass tests
DEUCE1957 Sep 19, 2025
fea484f
Test: Minor change to test_Action to include flexibility
DEUCE1957 Sep 19, 2025
9501a01
Test: Fix test_attached_envs for flexibility
DEUCE1957 Sep 19, 2025
49fbe35
Test: Fix flexibility_is_available check in GridObjects
DEUCE1957 Sep 19, 2025
18fd519
Test: Remove comma after flexiblity, in test_call to work in older py…
DEUCE1957 Sep 19, 2025
eadebf6
Add: Flexibility to PlayableAction
DEUCE1957 Sep 19, 2025
f7e9b91
Test: Fix Obs Size in aux_text_gym, fix missing default inside _prepa…
DEUCE1957 Sep 19, 2025
b47fbcf
fix issue spotted in discussion grid2op#728
BDonnot Oct 6, 2025
c07a42a
add a convient class to allow agent to modify the gen_v setpoints
BDonnot Oct 6, 2025
bc5b06b
fix a test not passing for gymnasium 1.2.1 - asynvectenv
BDonnot Oct 6, 2025
79f42cc
Merge pull request #729 from BDonnot/bd_dev
BDonnot Oct 6, 2025
8356742
bump to 1.12.2.dev1 [skip ci]
BDonnot Oct 6, 2025
58ef18e
synch with dev_1.12.2
BDonnot Oct 6, 2025
c7dcb9a
renaming flexibility to 'load_flexibility' [skip ci]
BDonnot Oct 6, 2025
5e1426b
Refact: 'load_flexibility' everywhere, Debug: Include 'rte_case5_flex…
DEUCE1957 Oct 9, 2025
41c7b3f
Debug: Add lxml to make pandapower happy
DEUCE1957 Oct 9, 2025
4ba64b3
Debug: Undo lxml addition
DEUCE1957 Oct 9, 2025
c65499a
Debug: Refactor _flexibility in PlayableAction to be '_load_flexibility'
DEUCE1957 Oct 9, 2025
b491d58
Debug: CI breaks without lxml as dependency
DEUCE1957 Oct 9, 2025
f1d66c2
Add: rte_case5_flexibility environment
DEUCE1957 Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 52 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,68 @@ jobs:
python -c "from grid2op import *"
python -c "from grid2op.Action._backendAction import _BackendAction"

- name: Build source archive
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp310'
run: python -m build --sdist .

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: grid2op-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl

source_build:
name: Build tar.gz grid2op file on ${{ matrix.config.name}}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: darwin,
os: macos-latest,
}
- {
name: windows,
os: windows-2022,
}
- {
name: linux,
os: ubuntu-latest,
}

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools build

- name: Build tar gz
run: python -m build --sdist .

- name: Install tar gz
shell: bash
run: |
python -m pip install dist/*.tar.gz --user
pip freeze

- name: Check package can be imported
run: |
python -c "import grid2op"
python -c "from grid2op import *"
python -c "from grid2op.Action._backendAction import _BackendAction"

- name: Upload source archive
if: (matrix.config.name == 'darwin')
uses: actions/upload-artifact@v4
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp310'
with:
name: grid2op-sources
path: dist/*.tar.gz

path: dist/*.tar.gz
auto_class_in_file:
name: Test ${{ matrix.config.name }} OS can handle automatic class generation for python ${{matrix.python.version}}
runs-on: ${{ matrix.config.os }}
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ Native multi agents support:
- add detachment
- add change_bus / set_bus

[1.12.2] - 2025-10-xx
----------------------
- [FIXED] an issue preventing to change the way
the voltages are set
- [FIXED] a test when using gymnasium>= 1.2.1 (AsynchVectEnv)
- [ADDED] a convenience class to allow agent to override
voltage setpoint from provided time seies (`VCFromFileAgentOverrides`)

[1.12.1] - 2025-08-28
----------------------
- [BREAKING] (small impact) action "property" `shunt_p`, `shunt_q` and `shunt_bus`
Expand Down
26 changes: 26 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
global-exclude */__pycache__/*
global-exclude *.pyc
recursive-exclude grid2op/data_test *
recursive-exclude binder *
recursive-exclude build *
recursive-exclude dist *
recursive-exclude docs *
recursive-exclude documentation *
recursive-exclude examples *
recursive-exclude getting_started *
recursive-exclude logo *
recursive-exclude utils *
recursive-exclude _profiling *
recursive-exclude .circleci *
recursive-exclude .git *
recursive-exclude .github *
recursive-exclude .idea *
recursive-exclude .ipynb_checkpoints *
recursive-exclude .pytest_cache *
recursive-exclude .vscode *
recursive-exclude . test_* .readthedocs.yml MakeFile Dockerfile
recursive-exclude grid2op/data/l2rpn_idf_2023/chronics keep_only_beginning.py
prune **venv*
prune **__pycache__*
prune **_grid2op_classes*
prune **.DS_Store*
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Benjamin Donnot'

# The full version, including alpha/beta/rc tags
release = '1.12.1'
release = '1.12.2.dev0'
version = '1.12'


Expand Down
37 changes: 36 additions & 1 deletion docs/grid2op_dev/action.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,43 @@ the `cls.authorized_keys` and
function `def supports_type` of SerializableActionSpace and
`cls.mapping_vect_auth_keys` (BaseAction)

Checklist for SerializableActionSpace:
Add a new ID number for your action to `SerializeableActionSpace`'s class attributes. Add this to the sample()
and "_get_possible_action_types()" methods.
Add a _sample_YOURACTION() method to `SerializableActionSpace`
Add a _aux_get_back_to_ref_state_YOURACTION() method.
Add your action to get_back_to_ref_state() method.
Optional: If your new action is continuous, add a get_all_unitary_YOURACTION() method to
`SerializableActionSpace` to help users discretize it.

Create a new YourAction.py file in `Grid2op/Action/*` and add this to the `Grid2Op/Action/__init__.py`.


Add the vectorization
***********************

TODO add the `cls.attr_list_vect`
TODO add the `cls.attr_list_vect` to baseAction:
* Add to baseAction.authorized_keys
* Add to baseAction.attr_list_vect
* Add to baseAction.mapping_vect_auth_keys
* Make sure your `self._private_YOURACTION = None` attribute is in baseAction's `__init__`
* Add a self._modif_YOURACTION to baseAction's `__init__`
* Double check you added a @property for your action in BaseAction
* Update the BaseAction._aux_copy() method to include your action (ideally in an if-statement)
* Modify the end of `process_grid2op_compat()`
* Add your _modif_YOURACTION to `reset_modified_flags()` and `can_affect_something()`
* Add your action to `_post_process_from_vect()` as appropriate
* Add a new method called `_aux_iadd_YOURACTION()` and reference this in `__iadd__()`
* Add your action to `__call__(self)` by referencing self._private_YOURACTION
* Add a `_digest_YOURACTION()` method
* Add an example to the docstring of `update(self)`
* Add modification check to `_check_for_corret_modif_flags()`
* Add ambiguity checks for your action in `_check_for_ambiguity()`, for instance by adding and calling a new `_is_YOURACTION_ambigious()` method
* Add a string formatting for your action to `__str__()`
* Add a check to `impact_on_objects()` for your action
* Add a boolean for your action in `get_types()`
* Modify `_aux_effect_on_XXX()` as appropriate
* If you action does NOT modify topology, add it to the `_dont_affect_topology()` method

Worry about the backward compatibility
****************************************
Expand Down Expand Up @@ -160,12 +192,15 @@ Backend "private" API

Then you need to modify the `__iadd__` method of the `BackendAction` class to handle the modification
you performed and pass it to the backend.
* Add a `set_YOURACTION()` if your action modifies setpoints / injections.


Add tests
-----------

TODO
* Add a test for creating the action type


Add documentation
-------------------
Expand Down
34 changes: 34 additions & 0 deletions docs/grid2op_dev/observation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
How to add a new type of observation attribute
===================================

Work in progress !

GridObjects
===================================
* Add your attribute(s) to the end of `_clear_grid_dependant_class_attributes()`, assume they are None / False by default.
For tidiness you could define a new DEFAULT_XXXX in default_var, but this is not required.
* Add your attributes to the appropriate `_li_attr_COMPONENT`, or define a new one in the class attributes. Do the same for `_type_attr_XXXX`.
* Ensure your new class attributes are also defined in `_clear_class_attributes(cls)`
* Add your attribute(s) to `_check_convert_to_numpy_array()` method, under the appropriate data type(s)
* Add your attribute flag(s), if any, to `assert_grid_correct_cls()`. You could for instance use a flag for checking if your attributes should exist.
If the logic gets complicated define a new `_check_validity_XXXX()` method.
* Add your attribute(s) to `_make_cls_dict()` and `_make_cls_dict_extended()` methods
* Add your attribute(s) to `from_dict()` method, with appropriate defaults.
* Add your attribute(s) to the `__str__()` method, note that this can break some unit tests - so would recommend doing this last (after you are passing all tests).


BaseObservation
===================================
* Add your attribute(s) to the class attribute: `attr_list_vect`
* Add empty array(s) for your attribute(s) in the `__init__()` method.
* Add your attribute(s) to the list of Literals in `state_of()` signature and add it/them to the appropriate res dictionary inside the method.
* Include your attribute(s) in the `reset()` method
* Append your attribute(s) to the appropriate `_aux_add_XXX()` method
* Add your attribute(s) to `_update_obs_complete()` method

CompleteObservation
===================================
* Append your attribute(s) to the class attribute: `attr_list_vect`.

.. include:: final.rst

4 changes: 1 addition & 3 deletions docs/user/rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ To illustrate this, let's create an environment that we'll use for an example an
import grid2op
env_name = "l2rpn_case14_sandbox"
env = grid2op.make(env_name)
env.set_id(0)
env.seed(0)

# for this example, we enforce that we need to wait 3 steps
# before being able to change again a line or a substation
Expand All @@ -61,7 +59,7 @@ To illustrate this, let's create an environment that we'll use for an example an
param.NB_TIMESTEP_COOLDOWN_LINE = 3
env.change_parameters(param)

obs = env.reset()
obs = env.reset(seed=0, options={"time serie id": 0})

# in summary (see descriptions bellow for more information) :
act_line_1 = env.action_space({"set_line_status": [(1, -1)]})
Expand Down
Loading