Skip to content

feat: Make env using custom config file path in kwargs#739

Open
kostialjn wants to merge 1 commit into
Grid2op:dev_1.12.4from
kostialjn:dev_1.12.4
Open

feat: Make env using custom config file path in kwargs#739
kostialjn wants to merge 1 commit into
Grid2op:dev_1.12.4from
kostialjn:dev_1.12.4

Conversation

@kostialjn

@kostialjn kostialjn commented Feb 12, 2026

Copy link
Copy Markdown

Specify custom config.py file using kwargs. Related to issue #738

# Load env using config.py in root directory
env = grid2op.make(root_path)

# Load env using custom config.py anywhere else
env = grid2op.make(root_path, _config_path="path/to/custom/config.py")

@sonarqubecloud

Copy link
Copy Markdown

@BDonnot

BDonnot commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Hello,

Is this PR still relevant or have you find a better solution ?

@kostialjn

Copy link
Copy Markdown
Author

@BDonnot

What we did was :

  • Create a fake empty config at env folder root
# Content of config.py
config = {}
  • Create several custom config.py (config1.py, config2.py, etc)
  • Import the one needed and load environment with it by assigning them through kwargs:
from .config1 import config
env = grid2op.make(..., **config)

The only problem was that some kwargs names are incompatible with some config.py fieds see issue #740 for instance

@BDonnot

BDonnot commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Get it 😊

This will be fixed in next release.

I will double check every config names to match the kwargs names.

But in the same time and before the release, I wanted to merge anything that could be merged.

This is why I wanted to check whether this makes sense to merge this PR.

BDonnot added a commit to BDonnot/Grid2Op that referenced this pull request Apr 27, 2026
BDonnot added a commit that referenced this pull request Jun 4, 2026
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.

2 participants