From b3fba54f03f16dd612085136c0479872ecb1fdf4 Mon Sep 17 00:00:00 2001 From: Rodrigo de Lazcano Date: Fri, 10 Feb 2023 16:19:19 -0500 Subject: [PATCH] Check for callable entrypoint (#108) * long description content type * fix callable entrypoint in doc generation * fix pytest registry callable * update pre-commit * update isort * fix callable entrypoint docs --- docs/scripts/gen_envs_display.py | 15 ++++++++------- docs/scripts/gen_gifs.py | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/scripts/gen_envs_display.py b/docs/scripts/gen_envs_display.py index e202968a..6e079593 100644 --- a/docs/scripts/gen_envs_display.py +++ b/docs/scripts/gen_envs_display.py @@ -10,13 +10,14 @@ # REWRITE: for new environments that don't include Fetch and Shadow Hand (D4RL) # TODO: use same format for Fetch and Shadow Hand # The environment entrypoints have the following standard: `gymnasium_robotics.envs.env_type.env_name:EnvName` - all_envs = [ - env_spec.entry_point - for env_spec in gym.registry.values() - if env_spec.entry_point.startswith("gymnasium_robotics.envs") - and "MujocoPy" - not in env_spec.entry_point # Exclude Fetch and Shadow Hand environments - ] + all_envs = [] + for env_spec in gym.envs.registry.values(): + if isinstance(env_spec.entry_point, str): + if ( + env_spec.entry_point.startswith("gymnasium_robotics.envs") + and "MujocoPy" not in env_spec.entry_point + ): + all_envs.append(env_spec) # Exclude Fetch and Shadow Hand environments filtered_envs_by_type = {} for entry_point in all_envs: env_full_name = entry_point.split(":") diff --git a/docs/scripts/gen_gifs.py b/docs/scripts/gen_gifs.py index 18747d09..8d05c695 100644 --- a/docs/scripts/gen_gifs.py +++ b/docs/scripts/gen_gifs.py @@ -9,13 +9,14 @@ # TODO: Add Fetch and Shadow Hand environments # The environment entrypoints have the following standard: `gymnasium_robotics.envs.env_type.env_name:EnvName` -all_envs = [ - env_spec - for env_spec in gym.registry.values() - if env_spec.entry_point.startswith("gymnasium_robotics.envs") - and "Mujoco" - not in env_spec.entry_point # Exclude Fetch and Shadow Hand environments -] +all_envs = [] +for env_spec in gym.envs.registry.values(): + if isinstance(env_spec.entry_point, str): + if ( + env_spec.entry_point.startswith("gymnasium_robotics.envs") + and "MujocoPy" not in env_spec.entry_point + ): + all_envs.append(env_spec) # Exclude Fetch and Shadow Hand environments # Keep latest version of environments filtered_envs_by_version = {}