From 12478409611b0e136e68284ea3ecc72d059bf400 Mon Sep 17 00:00:00 2001 From: Jesse Farebrother Date: Tue, 28 Sep 2021 18:08:25 -0400 Subject: [PATCH 1/2] Bump ale-py -> 0.7.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1994b5efcf3..29636513182 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ # Environment-specific dependencies. extras = { - "atari": ["ale-py~=0.7"], + "atari": ["ale-py~=0.7.1"], "accept-rom-license": ["autorom[accept-rom-license]~=0.4.2"], "box2d": ["box2d-py==2.3.5", "pyglet>=1.4.0"], "classic_control": ["pyglet>=1.4.0"], From 1a3ed9ced65e4a88074817e0c189b44f75597fc4 Mon Sep 17 00:00:00 2001 From: Jesse Farebrother Date: Tue, 28 Sep 2021 18:37:32 -0400 Subject: [PATCH 2/2] env-plugins: parse module,attr for Python 3.8 --- gym/envs/registration.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gym/envs/registration.py b/gym/envs/registration.py index a20db9757a1..8af22cceb72 100644 --- a/gym/envs/registration.py +++ b/gym/envs/registration.py @@ -248,18 +248,28 @@ def namespace(ns): def load_env_plugins(entry_point="gym.envs"): # Load third-party environments for plugin in metadata.entry_points().get(entry_point, []): - if plugin.attr is None: - raise error.Error( - f"Gym environment plugin `{plugin.module}` must specify a function to execute, not a root module" - ) + # Python 3.8 doesn't support plugin.module, plugin.attr + # So we'll have to try and parse this ourselves + try: + module, attr = plugin.module, plugin.attr + except AttributeError: + if ":" in plugin.value: + module, attr = plugin.value.split(":", maxsplit=1) + else: + module, attr = plugin.value, None + finally: + if attr is None: + raise error.Error( + f"Gym environment plugin `{module}` must specify a function to execute, not a root module" + ) context = namespace(plugin.name) if plugin.name == "__internal__": - if plugin.module in plugin_internal_whitelist: + if module in plugin_internal_whitelist: context = contextlib.nullcontext() else: logger.warn( - f"Trying to register an internal environment when `{plugin.module}` is not in the whitelist" + f"Trying to register an internal environment when `{module}` is not in the whitelist" ) with context: