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

Added list envs function (pretty print envs) #124

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

kad99kev
Copy link
Contributor

@kad99kev kad99kev commented Nov 12, 2022

Description

Added a function that lists all the current environments supported/present, neatly.
Resolves #75

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • 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.

Before After
Screenshot 2022-11-12 at 11 28 30 AM Screenshot 2022-11-12 at 11 29 25 AM

Checklist:

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

@pseudo-rnd-thoughts
Copy link
Member

pseudo-rnd-thoughts commented Nov 12, 2022

Thanks for the PR, could you add a test, just that this function works. Maybe add a couple of testing environments with different namespaces, etc and check the output is equal to an expected values.

Could you change the registry to add registry in __init__.py such that

# old code
registry: dict[str, EnvSpec] = {}

# new code
registry.pprint = list_env_spec
registry.__str__ = partial(list_env_spec, 10)

Another comment, change the function name to registry_pretty_print

My hope is being able to call print(gymnasium.registry) to get the pretty print versions
Then you can call print(gymnasium.registry.pprint(10)) for selecting the pretty print options

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit 4d55f7c into Farama-Foundation:main Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Pretty print environment registry
2 participants