Commit Graph

1491 Commits

Author SHA1 Message Date
Rushiv Arora
2b6ec51580 Doc typos (#2597)
* Minor Mujoco Doc Typos

* Fixed precommit black
2022-02-07 22:53:47 -05:00
Omar Younis
80d28e5a9c fix #2600 (#2601)
* add pygame GUI for frozen_lake.py env

* add new line at EOF

* pre-commit reformat

* improve graphics

* new images and dynamic window size

* darker tile borders and fix ICC profile

* pre-commit hook

* adjust elf and stool size

* Update frozen_lake.py

* reformat

* fix #2600

* #2600

Co-authored-by: J K Terry <jkterry0@gmail.com>
2022-02-07 20:48:48 -05:00
John Balis
15049e22d7 Adding return_info argument to reset to allow for optional info dict as a second return value (#2546)
* initial draft of optional info dict in reset function, implemented for cartpole, tests seem to be passing

* merged core.py

* updated return type annotation for reset function in core.py

* optional metadata with return_info from reset added for all first party environments, with corresponding tests. Incomplete implementation for wrappers and vector wrappers

* removed Optional type for return_info arguments

* added tests for return_info to normalize wrapper and sync_vector_env

* autoformatted using black

* added optional reset metadata tests to several wrappers

* added return_info capability to async_vector_env.py and test to verify functionality

* added optional return_info test for record_video.py

* removed tests for mujoco environments

* autoformatted

* improved test coverage for optional reset return_info

* re-removed unit test envs accidentally reintroduced in merge

* removed unnecessary import

* changes based on code-review

* small fix to core wrapper typing and autoformatted record_epsisode_stats

* small change to pass flake8 style
2022-02-06 18:28:27 -05:00
Carlos Luis
62e52727d5 Fix jerky camera angle in car racing env (#2525)
* Fix jerky camera angle in car racing env

* Bump the version of CarRacing

* Fix episode termination criterion in car racing env

* Improve lap detection and add argument

* Fix pre-commit

Co-authored-by: J K Terry <justinkterry@gmail.com>
2022-02-06 17:13:11 -05:00
Omar Younis
c6b6754b12 add pygame GUI for frozen_lake.py env (#2568)
* add pygame GUI for frozen_lake.py env

* add new line at EOF

* pre-commit reformat

* improve graphics

* new images and dynamic window size

* darker tile borders and fix ICC profile

* pre-commit hook

* adjust elf and stool size

* Update frozen_lake.py

* reformat

Co-authored-by: J K Terry <jkterry0@gmail.com>
2022-02-05 11:52:02 -05:00
Ilya Kamen
cf634bb444 Add typing to Wrapper signatures (#2590) 2022-02-05 11:25:47 -05:00
Andrew Tan Jin Shen
2e36cde12e Refactor Lunar Lander and Bipedal Walker to use Pygame (#2552)
* Refactor lunar lander to use pygame

* Fix minor rendering inconsistency

* Refactor bipedal walker to use pygame

* Reformat with black

* Remove viewer

* Fix color for obstacles

* Update dependencies for box2d

* Optimize screen initialization
2022-02-05 09:42:45 -05:00
trigaten
11760cd0b0 More richer reacher (#2591) 2022-02-03 08:13:26 -05:00
Rushiv Arora
3f753d75a3 documentation for Mujoco Envs as Docstrings (#2588) 2022-02-02 09:00:27 -05:00
Markus28
2b993c8b98 Supress PyGame import message (#2585) 2022-02-02 09:00:19 -05:00
Adil Zouitine
58aeddb62f Fix RecordEpisodeStatistics wrapper for AsyncEnv (#2586) 2022-01-29 20:44:31 -05:00
trigaten
079c4c9527 Add version histories (#2587)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

* put docstrings in base environments rather than highest version

* fix richer reacher

* black

* correct black version

* continuous mountain car docstring to markdown

* remove unneeded images

* black

* fix quote

* docs: add version history to Box2D envs

* Update lunar_lander.py

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-29 17:53:28 -05:00
Tristan Deleu
39ba73ff17 Add call, get_attr and set_attr methods to VectorEnv (#1600)
* Add call, get_attr and set_attr methods

* Use f-strings and remove assert

* Allow tuples in set_attr and move docstrings

* Replace CubeCrash by CartPole in tests
2022-01-29 12:33:00 -05:00
Tristan Deleu
081c5c1e80 Add call, get_attr and set_attr methods to VectorEnv (#1600)
* Add call, get_attr and set_attr methods

* Use f-strings and remove assert

* Allow tuples in set_attr and move docstrings

* Replace CubeCrash by CartPole in tests
2022-01-29 12:32:35 -05:00
trigaten
b9e8b6c587 Reformat some docstrings, remove unneeded image links (#2578)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

* put docstrings in base environments rather than highest version

* fix richer reacher

* black

* correct black version

* continuous mountain car docstring to markdown

* remove unneeded images

* black

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-27 15:36:50 -05:00
Jared
91d278f2dd Add 'MIT' to license metadata field in setup.py (#2576) 2022-01-26 21:26:54 -05:00
trigaten
b5b40b17bd richer reacher fix and small docstring reorganization (#2577)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

* put docstrings in base environments rather than highest version

* fix richer reacher

* black

* correct black version

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-26 21:21:10 -05:00
trigaten
a149869bcb docs+credits (#2574)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-26 16:02:42 -05:00
Ilya Kamen
ad79b0ad0f typing in gym.spaces (#2541)
* typing in spaces.Box and spaces.Discrete

* adds typing to dict and tuple spaces

* Typecheck all spaces

* Explicit regex to include all files under space folder

* Style: use native types and __future__ annotations

* Allow only specific strings for Box.is_bounded args

* Add typing to changes from #2517

* Remove Literal as it's not supported by py3.7

* Use more recent version of pyright

* Avoid name clash for type checker

* Revert "Avoid name clash for type checker"

This reverts commit 1aaf3e0e0328171623a17a997b65fe734bc0afb1.

* Ignore the error. It's reported as probable bug at https://github.com/microsoft/pyright/issues/2852

* rebase and add typing for `_short_repr`
2022-01-24 17:22:11 -05:00
Rushiv Arora
fcbff7de12 Added singledispatch utility to vector.utils & changed order of space argument. (#2536)
* Fixed ordering of space. Added singledispatch utility.

* Added singledispatch utility to vector.utils & changed order of space argument

* Fixed Error from _BaseGymSpaces

* Minor adjustment for Discrete Spaces

* Fixed Tests/ to reflect changes

* Fixed precommit error - custom namespaces

* Concrete Implementations start with _
2022-01-21 11:28:34 -05:00
Ariel Kwiatkowski
925823661d Add options to the signature of env.reset (#2515)
* First find/replace, now tests

* Fixes to the vector env

* Make seed keyword only in wrappers

* (try to) fix the bug with old environments using new wrappers (with the seed keyword)

* black

* Change **kwargs to options, try to make it work; black

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs
black

* Update the env checker

* Update the env checker

* Update the env checker to use inspect (might fail tests, let's see)

* Allow the signature to include kwargs in env_checker

* Minor fix
2022-01-19 17:28:59 -05:00
Ariel Kwiatkowski
186934562f Attempt to fix blackjack rendering tests (#2565)
* Consistently use os.path.join

* Update setup.py

Try to fix tests again
2022-01-19 17:28:43 -05:00
J K Terry
95d649fdec fix pygame rendering dependency 2022-01-19 14:54:20 -05:00
Georg Reich
0bbef5f0fb Added blackjack toytext rendering support (#2550) 2022-01-19 14:52:00 -05:00
Andrea PIERRÉ
d653ebf3b7 Remove mandatory version in environment name (#2535)
* refactor: required version in env name

* refactor: rename env_id function

* refactor: regex + function logic

* test: some more edge cases + error

* refactor: version max/comparison

- Move version max/comparison in a method
- Remove type ignore to improve type checking

* fix: failing tests & error introduced in rebasing

* refactor: simplify map and remove type ignore

* refactor: remove _is_lesser_version() method

* refactor: _versions() to return NamedTuples

* chore: remove minor changes

* Refactor registration EnvSpec and EnvSpecTree

* test: move tests from #2513 here

* fix: typing

* test: try to fix unregistered env

* refactor: change InitVar id name for typing

Changed InitVar id name to fix the following typing error:
error: Declaration "id" is obscured by a declaration of the same name

* refactor: return only the first difflib match

* test: improve tear down of added test env

* refactor: dataclass fields

* refactor: compile regex pattern only once

* refactor: `_assert_version_exists()`

`_assert_version_exists()` rewritten from @JesseFarebro:
https://github.com/openai/gym/pull/2535#discussion_r777573839

* refactor: latest_spec -> latest_versioned_spec

* fix: bug + typing + test

* Add default/versioned tests

* Fix Env field defaults

* feat: improve versioned/unversioned env handling

* Disallow versioned/unversioned registration/lookup

* test: remove warning + check default suggestion

Co-authored-by: Jesse Farebrother <jessefarebro@gmail.com>
2022-01-19 13:50:25 -05:00
Costa Huang
4424278917 Remove reset enforceing in the TimeLimit wrapper (#2556)
* Remove reset enforceing in the `TimeLimit` wrapper

* push changes

* Always enforce order
2022-01-13 15:59:55 -05:00
Markus28
057b71e89e Implement simplified Box representation (#2554)
* Implement short Box.__repr__, potentially resolve #2497

* Added comment, fix representation at initialization
2022-01-13 13:41:53 -05:00
Ilya Kamen
e9df493243 Py36+ code style in tests (#2547) 2022-01-11 12:12:05 -05:00
Jet
3746741708 Potential fix for integer overflow in box spaces (#2517)
* fix box infinite bounds

* Revert "fix box infinite bounds"

This reverts commit 8e27a01fda839f522fc5a0855350e5a543359c47.

* fix box space infinite bounds

* experiencing unit test failures with master build on windows, shifting to Linux to test

* box space infinite bounds fixed, all unit test pass, though the solution is still less elegant than I'd like

* bracket fix

* black formatting

* remove redundant casting to np.array for array spaces

* previous changes unintentionally changed the sampling method for float dtype infinite, this commit fixes that. Float infinite bounds are sampled either using shifted exponential or normal depending on circumstance, but int infinite bounds are always sampled uniformly.

* added more tests as per #2517, made some error messages more descriptive, changed logic for calculating inf for ints

* accidentally commented out something I shouldn't have commented out

* moved get_inf and get_precision to non-static functions

* Move get_precision and get_inf outside of class

* Don't edit code within github's editor lol:wq

* black
2022-01-10 23:45:41 -05:00
Costa Huang
cfed339701 Remove unittest envs (#2553) 2022-01-10 23:42:26 -05:00
Carlos Luis
8a96440084 Move rendering.py to utils (#2551)
* Move rendering.py to utils

* Rename rendering.py to pyglet_rendering.py
2022-01-06 13:01:29 -05:00
Jesse Farebrother
2af816241e Fix namespace relocation error messages + update Robotic env relocation namespace (#2539)
* Update namespace relocation error message

* Add missing relocated envs + move to new file
2021-12-22 18:51:33 -05:00
Jesse Farebrother
eb6d826aac Update importlib_metadata entry_point calls (#2538) 2021-12-22 13:54:20 -05:00
Carlos Luis
102cd1bf4c Remove DiscreteEnv class (#2514) 2021-12-22 13:25:36 -05:00
Andrew Tan Jin Shen
4fe7efaacd Consolidate LunarLander and BipedalWalker envs (#2522)
* Consolidate LunarLander and BipedalWalker envs

* Update LunarLander tests

* Add type hints

* Add detailed error message on instantiating deprecated environments

* Fix formatting with black pre-commit

Co-authored-by: Andrew Tan Jin Shen <andrew.tanjs@shopee.com>
2021-12-22 13:25:07 -05:00
Ilya Kamen
65eeb73366 Typing/basics (#2529)
* Typing in gym/envs/registration.py

* Add registration to type checked list

* Adds type hints to space.py

* Typing in gym.core.Env

* Typing in seeding.py

* fixup Typing after rebase

* revert accidental change

* Install dependencies in pyright runner

* fix: can only install dependencies after checkout

* fix: install types in a venv

* fix path

* skip env activation, install directly from venv interpreter

* absolute path to venv

* use central python installation

* skip one more typecheck

* cleanup gh actions .yml

* Add py.typed to signal using sources for typechecking

* black!

Co-authored-by: sj_petterson <sj_petterson@gmail.com>
Co-authored-by: J K Terry <justinkterry@gmail.com>
2021-12-22 13:12:57 -05:00
Rohan138
4966c5fccf Added robotics envs to relocation map (#2537) 2021-12-21 14:07:36 -05:00
J K Terry
6d3a34823e Update env_checker.py 2021-12-21 14:05:40 -05:00
Seungjae Ryan Lee
616b071158 Remove Robotics environments from Gym (#2516)
* Remove registration of Robotics envs

* Remove Robotics environments

* Update setup.py

* Update unit tests

* Remove unused GoalEnv class
2021-12-21 09:46:24 -05:00
J K Terry
51ffa07a96 Update README.md 2021-12-21 01:13:25 -05:00
J K Terry
523b9ee8b7 move docs to https://github.com/Farama-Foundation/gym-docs 2021-12-21 01:12:02 -05:00
J K Terry
5e43d10e25 Delete acrobot.png 2021-12-21 00:52:35 -05:00
Mohamad H. Danesh
ce79c423d5 Providing documentation (#2534)
* Create mountain_car.md

* Create continuous_mountain_car.md

* Create classic_control.md

* Update classic_control.md

* Update classic_control.md

* Update continuous_mountain_car.md

* Update mountain_car.md
2021-12-21 00:36:53 -05:00
Brendan King
14eaf04de6 Adding documentation for Acrobot-v1 in docs/classic_control (#2533)
* Adding documentation for Acrobot-v1 in docs/classic_control

* Update acrobot.md

Co-authored-by: J K Terry <justinkterry@gmail.com>
2021-12-20 13:28:39 -05:00
Brendan King
9c0808eb9a Adding documentation for CartPole-v1 in docs/classic_control (#2509)
* Adding documentation for CartPole-v1 in docs/classic_control

* typo

Co-authored-by: J K Terry <justinkterry@gmail.com>
2021-12-20 02:06:24 -05:00
Jesse Farebrother
a30568a06e plugins: Remove allow-list for registering environments in the root namespace (#2530) 2021-12-20 01:55:55 -05:00
Xuehai Pan
18c8b988d4 Type cast in spaces families (#2491)
* Type cast for `spaces.Dict`

* Type cast for `spaces.Tuple`

* Type cast for `spaces.Discrete`

* Type cast for `spaces.MultiDiscrete`

* Type cast for `spaces.MultiBinary`
2021-12-16 00:45:37 -05:00
Ryan Amaral
180d8ddd5c Removed mypy from CI tests (#2520)
* test actions

* removed mypy check and un-indent

* re-indent

* deleted test comment
2021-12-11 12:09:03 -05:00
J K Terry
9180d12e1b typo 2021-12-10 18:06:07 -05:00
Ariel Kwiatkowski
a867dd60df Fix a typo in requirements (#2519) 2021-12-10 18:05:48 -05:00