Skip to content

Commit 6e1f5b6

Browse files
authored
[release] Bump EnvPool assets to 0.3.0 (#414)
## Description This bumps EnvPool to 1.2.5 and updates release asset resolution for the published `envpool-assets==0.3.0` split packages: - `envpool-assets` - `envpool-assets-mujoco-large` - `envpool-assets-mujoco-playground-humanoid` The registration modules now resolve assets from the owning split asset package, while keeping the existing local-package / `ENVPOOL_ASSETS_PATH` fallback path. The release smoke check also verifies representative files from each split asset wheel. ## Motivation and Context This fixes missing MuJoCo Playground assets in the 1.2.4 release path, where installed wheels could register Playground envs but fail at runtime because the XML assets were not present in `envpool-assets`. Fixes #413. - [x] I have raised an issue to propose this change ([required](https://envpool.readthedocs.io/en/latest/pages/contributing.html) for new features and bug fixes) ## Types of changes What types of changes does your code introduce? Put an `x` in all the boxes that apply: - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds core functionality) - [ ] New environment (non-breaking change which adds 3rd-party environment) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation (update in the documentation) - [ ] Example (update in the folder of example) ## Implemented Tasks - [x] Bump EnvPool version to 1.2.5 and require asset wheels `>=0.3.0,<0.4.0` - [x] Route base, MyoSuite, and MuJoCo Playground registrations to the correct split asset packages - [x] Extend release smoke checks to cover the split asset packages and a Playground env ## Checklist Go over all the following points, and put an `x` in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help! - [x] I have read the [CONTRIBUTION](https://envpool.readthedocs.io/en/latest/pages/contributing.html) guide (**required**) - [ ] My change requires a change to the documentation. - [x] I have updated the tests accordingly (*required for a bug fix or a new feature*). - [ ] I have updated the documentation accordingly. - [ ] I have reformatted the code using `make format` (**required**) - [ ] I have checked the code using `make lint` (**required**) - [ ] I have ensured `make bazel-test` pass. (**required**) Validation run: - `python3 -m py_compile envpool/registration.py envpool/atari/registration.py envpool/gfootball/registration.py envpool/procgen/registration.py envpool/vizdoom/registration.py envpool/mujoco/dmc/registration.py envpool/mujoco/gym/registration.py envpool/mujoco/metaworld/registration.py envpool/mujoco/myosuite/registration.py envpool/mujoco/playground/registration.py envpool/mujoco/robotics/registration.py scripts/release_installed_wheel_smoke.py` - `git diff --check origin/main...HEAD` - `envpool-assets` GitHub Actions run `26133010572` built and published all three `0.3.0` asset wheels successfully
1 parent 9cbcd26 commit 6e1f5b6

18 files changed

Lines changed: 326 additions & 52 deletions

File tree

BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ filegroup(
5252
srcs = [".clang-tidy"],
5353
)
5454

55+
filegroup(
56+
name = "setup_cfg",
57+
srcs = ["setup.cfg"],
58+
visibility = ["//visibility:public"],
59+
)
60+
5561
py_binary(
5662
name = "setup",
5763
srcs = _SETUP_SRCS,

envpool/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ py_test(
8181
name = "make_test",
8282
timeout = "long",
8383
srcs = ["make_test.py"],
84+
data = ["//:setup_cfg"],
8485
imports = [".."],
8586
deps = [
8687
":envpool",

envpool/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
register,
3838
)
3939

40-
__version__ = "1.2.4"
40+
__version__ = "1.2.5"
4141
__all__ = [
4242
"register",
4343
"make",

envpool/atari/registration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
import os
1717

18-
from envpool.registration import base_path, register
18+
from envpool.registration import asset_base_path, register
1919

20-
atari_rom_path = os.path.join(base_path, "atari", "roms")
20+
_ATARI_BASE_PATH = asset_base_path("envpool_assets", "atari/roms")
21+
atari_rom_path = os.path.join(_ATARI_BASE_PATH, "atari", "roms")
2122
atari_game_list = sorted([
2223
i.replace(".bin", "") for i in os.listdir(atari_rom_path)
2324
])
@@ -32,4 +33,5 @@
3233
gymnasium_cls="AtariGymnasiumEnvPool",
3334
task=game,
3435
max_episode_steps=27000,
36+
base_path=_ATARI_BASE_PATH,
3537
)

envpool/gfootball/registration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# limitations under the License.
1414
"""Google Research Football env registration."""
1515

16-
from envpool.registration import register
16+
from envpool.registration import asset_base_path, register
17+
18+
_GFOOTBALL_BASE_PATH = asset_base_path("envpool_assets", "gfootball/assets")
1719

1820
_SCENARIOS = (
1921
("11_vs_11_competition", 3000),
@@ -45,4 +47,5 @@
4547
spec_cls="GfootballEnvSpec",
4648
dm_cls="GfootballDMEnvPool",
4749
gymnasium_cls="GfootballGymnasiumEnvPool",
50+
base_path=_GFOOTBALL_BASE_PATH,
4851
)

envpool/make_test.py

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
"""Test for envpool.make."""
1515

16+
import configparser
1617
import gc
1718
import os
1819
import pprint
@@ -22,6 +23,7 @@
2223
from contextlib import contextmanager
2324
from pathlib import Path
2425
from typing import Callable, get_type_hints
26+
from unittest import mock
2527

2628
import dm_env
2729
import gymnasium
@@ -60,6 +62,32 @@
6062
"img_height": 240,
6163
}
6264

65+
_FAMILY_SMOKE_TASKS: dict[str, tuple[str, ...]] = {
66+
"envpool.atari": ("Defender-v5",),
67+
"envpool.box2d": ("LunarLander-v3",),
68+
"envpool.classic_control": ("CartPole-v1",),
69+
"envpool.gfootball": ("gfootball/academy_empty_goal_close-v1",),
70+
"envpool.highway": ("HighwayFast-v0",),
71+
"envpool.jumanji": ("Game2048-v1",),
72+
"envpool.minigrid": ("MiniGrid-DoorKey-8x8-v0",),
73+
"envpool.mujoco.dmc": ("WalkerWalk-v1",),
74+
"envpool.mujoco.gym": ("Ant-v5",),
75+
"envpool.mujoco.metaworld": ("MetaWorld/Reach-v3",),
76+
"envpool.mujoco.playground": (
77+
"Go1JoystickFlatTerrain-v1",
78+
"G1JoystickFlatTerrain-v1",
79+
),
80+
"envpool.mujoco.robotics": ("FetchReach-v4",),
81+
"envpool.pgx": ("TicTacToe-v1",),
82+
"envpool.procgen": ("CoinrunEasy-v0",),
83+
"envpool.toy_text": ("Catch-v0",),
84+
"envpool.vizdoom": ("MyWayHome-v1",),
85+
}
86+
87+
_DYNAMIC_FAMILY_SMOKE_PREFIXES: dict[str, str] = {
88+
"envpool.mujoco.myosuite": "MyoSuite/",
89+
}
90+
6391

6492
@contextmanager
6593
def _temporary_workdir(prefix: str) -> Iterator[str]:
@@ -89,6 +117,23 @@ def _stable_render_kwargs(task_id: str, **kwargs: object) -> dict[str, object]:
89117

90118

91119
class _MakeTest(absltest.TestCase):
120+
def _family_smoke_tasks(self) -> dict[str, tuple[str, ...]]:
121+
from envpool.registration import registry
122+
123+
tasks = dict(_FAMILY_SMOKE_TASKS)
124+
for import_path, prefix in _DYNAMIC_FAMILY_SMOKE_PREFIXES.items():
125+
candidates = sorted(
126+
task_id
127+
for task_id, (registered_import_path, _, _) in (
128+
registry.specs.items()
129+
)
130+
if registered_import_path == import_path
131+
and task_id.startswith(prefix)
132+
)
133+
self.assertNotEmpty(candidates, import_path)
134+
tasks[import_path] = (candidates[0],)
135+
return tasks
136+
92137
def check_render_unsupported(self, task_id: str, **kwargs: object) -> None:
93138
for factory in (envpool.make_gym, envpool.make_gymnasium):
94139
with self.assertRaisesRegex(RuntimeError, "render not implemented"):
@@ -131,7 +176,19 @@ def render_once(factory: _RenderFactory) -> None:
131176
raise
132177

133178
def test_version(self) -> None:
134-
print(envpool.__version__)
179+
config = configparser.ConfigParser()
180+
self.assertTrue(config.read(Path(__file__).parents[1] / "setup.cfg"))
181+
self.assertEqual(config["metadata"]["version"], envpool.__version__)
182+
183+
def test_asset_base_path_env_override(self) -> None:
184+
from envpool.registration import asset_base_path
185+
186+
with tempfile.TemporaryDirectory() as tmpdir:
187+
with mock.patch.dict(os.environ, {"ENVPOOL_ASSETS_PATH": tmpdir}):
188+
self.assertEqual(
189+
asset_base_path("envpool_assets", "atari/roms"),
190+
os.path.abspath(tmpdir),
191+
)
135192

136193
def test_public_typing_interface(self) -> None:
137194
self.assertTrue(Path(envpool.__file__).with_name("py.typed").is_file())
@@ -162,6 +219,26 @@ def test_public_typing_interface(self) -> None:
162219
def test_list_all_envs(self) -> None:
163220
pprint.pprint(envpool.list_all_envs())
164221

222+
def test_make_registered_env_families(self) -> None:
223+
from envpool.registration import registry
224+
225+
registered_import_paths = {
226+
import_path for import_path, _, _ in registry.specs.values()
227+
}
228+
smoke_tasks = self._family_smoke_tasks()
229+
self.assertEmpty(registered_import_paths - smoke_tasks.keys())
230+
self.assertEmpty(smoke_tasks.keys() - registered_import_paths)
231+
missing_task_ids = [
232+
task_id
233+
for task_ids in smoke_tasks.values()
234+
for task_id in task_ids
235+
if task_id not in registry.specs
236+
]
237+
self.assertEmpty(missing_task_ids)
238+
for import_path, task_ids in smoke_tasks.items():
239+
with self.subTest(import_path=import_path):
240+
self.check_step(list(task_ids))
241+
165242
def test_make_atari(self) -> None:
166243
self.assertRaises(TypeError, envpool.make, "Pong-v5")
167244
spec = envpool.make_spec("Defender-v5")
@@ -419,6 +496,11 @@ def test_make_mujoco_dmc(self) -> None:
419496
"WalkerWalk-v1",
420497
])
421498

499+
def test_make_mujoco_playground(self) -> None:
500+
self.check_step([
501+
"Go1JoystickFlatTerrain-v1",
502+
])
503+
422504
def test_render_smoke(self) -> None:
423505
self.check_render("CartPole-v1")
424506
self.check_render("LunarLander-v3")

envpool/mujoco/dmc/registration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# limitations under the License.
1414
"""Mujoco dm_control suite env registration."""
1515

16-
from envpool.registration import register
16+
from envpool.registration import asset_base_path, register
17+
18+
_DMC_BASE_PATH = asset_base_path("envpool_assets", "mujoco/assets_dmc")
1719

1820
# from suite.BENCHMARKING
1921
dmc_mujoco_envs = [
@@ -81,4 +83,5 @@
8183
gymnasium_cls=f"Dmc{domain_name}GymnasiumEnvPool",
8284
task_name=task,
8385
max_episode_steps=max_episode_steps,
86+
base_path=_DMC_BASE_PATH,
8487
)

envpool/mujoco/gym/registration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
from typing import Any
1717

18-
from envpool.registration import register
18+
from envpool.registration import asset_base_path, register
19+
20+
_GYM_BASE_PATH = asset_base_path("envpool_assets", "mujoco/assets_gym")
1921

2022
gym_mujoco_envs = [
2123
("Ant", ("v3", "v4", "v5"), 1000),
@@ -89,5 +91,6 @@
8991
gymnasium_cls=f"Gym{task}GymnasiumEnvPool",
9092
post_constraint=(version == "v5"),
9193
max_episode_steps=max_episode_steps,
94+
base_path=_GYM_BASE_PATH,
9295
**extra_args,
9396
)

envpool/mujoco/metaworld/registration.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
# limitations under the License.
1414
"""MetaWorld v3 Sawyer env registration."""
1515

16-
from envpool.registration import register
16+
from envpool.registration import asset_base_path, register
17+
18+
_METAWORLD_BASE_PATH = asset_base_path(
19+
"envpool_assets", "mujoco/metaworld/assets"
20+
)
1721

1822

1923
def metaworld_public_task_name(task_name: str) -> str:
@@ -96,4 +100,5 @@ def metaworld_task_id(task_name: str) -> str:
96100
gymnasium_cls="MetaWorldGymnasiumEnvPool",
97101
task_name=task_name,
98102
max_episode_steps=500,
103+
base_path=_METAWORLD_BASE_PATH,
99104
)

envpool/mujoco/myosuite/registration.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@
1313
# limitations under the License.
1414
"""MyoSuite v2.11.6 env registration."""
1515

16-
import os
17-
18-
from envpool.registration import base_path, package_base_path, register
16+
from envpool.registration import asset_base_path, register
1917

2018
from .tasks import MYOSUITE_TASKS
2119

2220
myosuite_task_ids = [str(task["id"]) for task in MYOSUITE_TASKS]
2321
myosuite_envpool_task_ids = [
2422
f"MyoSuite/{task_id}" for task_id in myosuite_task_ids
2523
]
26-
_myosuite_package_assets = os.path.join(
27-
package_base_path, "mujoco/myosuite/assets"
28-
)
29-
_myosuite_base_path = (
30-
package_base_path if os.path.exists(_myosuite_package_assets) else base_path
24+
_MYOSUITE_BASE_PATH = asset_base_path(
25+
"envpool_assets_mujoco_large", "mujoco/myosuite/assets"
3126
)
3227

3328
for task in MYOSUITE_TASKS:
@@ -41,5 +36,5 @@
4136
gymnasium_cls="MyoSuiteGymnasiumEnvPool",
4237
task_name=task_id,
4338
max_episode_steps=task["max_episode_steps"],
44-
base_path=_myosuite_base_path,
39+
base_path=_MYOSUITE_BASE_PATH,
4540
)

0 commit comments

Comments
 (0)