Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gymnasium 1.0 support #89

Merged
merged 5 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- run: pip install pre-commit
- run: pre-commit --version
- run: pre-commit install
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ The following code performs a deterministic action on the
```python
import time
import gymnasium
import miniwob
from miniwob.action import ActionTypes

gymnasium.register_envs(miniwob)

env = gymnasium.make('miniwob/click-test-2-v1', render_mode='human')

# Wrap the code in try-finally to ensure proper cleanup.
Expand Down
2 changes: 2 additions & 0 deletions docs/_scripts/gen_env_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import gymnasium as gym
import pandas as pd

import miniwob
from utils import extract_description_from_docstring, get_all_registered_miniwob_envs


gym.register_envs(miniwob)
gym.logger.set_level(gym.logger.DISABLED)

ENV_TYPES = [
Expand Down
2 changes: 2 additions & 0 deletions docs/_scripts/gen_mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

import gymnasium as gym

import miniwob
from utils import get_all_registered_miniwob_envs, trim_docstring


LAYOUT = "env"

gym.register_envs(miniwob)
gym.logger.set_level(gym.logger.DISABLED)


Expand Down
3 changes: 3 additions & 0 deletions docs/content/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ The following code performs a deterministic action on the
```python
import time
import gymnasium
import miniwob
from miniwob.action import ActionTypes

gymnasium.register_envs(miniwob)

env = gymnasium.make('miniwob/click-test-2-v1', render_mode='human')

# Wrap the code in try-finally to ensure proper cleanup.
Expand Down
1 change: 1 addition & 0 deletions docs/content/custom_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ from miniwob.fields import field_lookup

# Import `custom_registry.py` above to register the task.
import custom_registry
gymnasium.register_envs(custom_registry)

# Create an environment.
env = gymnasium.make('miniwob/custom-v0', render_mode='human')
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Exploration](https://arxiv.org/abs/1802.08802).
The Gymnasium interface allows an agent to initialize and interact with a MiniWoB++ environment as follows:
```python
import gymnasium
import miniwob
gymnasium.register_envs(miniwob)
env = gymnasium.make('miniwob/click-test-2-v1', render_mode='human')
try:
observation, info = env.reset(seed=42)
Expand Down
6 changes: 5 additions & 1 deletion miniwob/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Root `__init__` of the miniwob module."""
import sys

from miniwob.registration import register_miniwob_envs

__version__ = "1.0"

__version__ = "1.0.1"

register_miniwob_envs()

try:
from farama_notifications import notifications
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"Gymnasium==0.29.0",
"Gymnasium>=1.0.0a1",
"Pillow>=9.0.0",
"selenium>=4.5.0",
"numpy>=1.18.0",
"farama-notifications >=0.0.1",
"farama-notifications>=0.0.1",
]
dynamic = ["version"]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from gymnasium import spaces
from gymnasium.utils.env_checker import check_env
from gymnasium.wrappers.flatten_observation import FlattenObservation
from gymnasium.wrappers import FlattenObservation

from tests.utils import get_all_registered_miniwob_envs

Expand Down
Loading