Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.09k stars 604 forks source link

Register environments with entrypoint in setup.py #205

Closed rodrigodelazcano closed 2 years ago

rodrigodelazcano commented 2 years ago

Description

Specify an entrypoint in the setup.py to create a plugin for the gym_minigrid environments under the name space gym.envs. This will allow to initialize environments directly with the environment name id without having to import gym_minigrid or specifying the module name like `gym.make('gym_minigrid:env_id_name').

Before this PR

env = gym.make('MiniGrid-PutNear-6x6-N2-v0')

- Long environment name:

import gym

env = gym.make('gym_minigrid:MiniGrid-PutNear-6x6-N2-v0')


**After this PR**

import gym

env = gym.make('MiniGrid-PutNear-6x6-N2-v0')


Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

### Screenshots
Please attach before and after screenshots of the change if applicable.

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections.
-->

# Checklist:

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `pre-commit run --all-files` (see `CONTRIBUTING.md` instructions to set it up)
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes

<!--
As you go through the checklist above, you can mark something as done by putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
pseudo-rnd-thoughts commented 2 years ago

Should we not remove the register.py file with this change?