* Added a new compatibility wrapper along with tests
* Fix for 3.6 typing
* Fix for 3.6 typing again
* Add make integration
* Unrelated change that for some reason is necessary to fix pyright
* Ignore weird (and very non-critical) type check bug
* Adjust old tests
* Rename the compatibility argument in make
* Rename the compatibility argument in register and envspec
* Documentation updates
* Remove test envs from the registry
* Some rogue renames
* Add nicer str and repr to the compatibility layer
* Reorder the compatibility layer application
* Add metadata to test envs
* Add proper handling of automatic human rendering
* Add auto human rendering to reset
* Enable setting render_mode in gym.make
* Documentation update
* Fix an unrelated stochastic test
* initial commit
* Fix the multi-binary sample and upgrade multi-discrete sample
* Fix MultiBinary sample tests and pre-commit
* Adds coverage tests and updates test_utils.py to use the utils.py spaces. Fix bug in text.py
* pre-commit
* Added Sequence space, updated flatten functions to work with Sequence, Graph. WIP.
* Small fixes, added Sequence space to tests
* Replace Optional[Any] by Any
* Added tests for flattening of non-numpy-flattenable spaces
* Return all seeds
* Allows a new RNG to be generated with seed=-1 and updated env_checker to fix bug if environment doesn't use np_random in reset
* Revert "fixed `gym.vector.make` where the checker was being applied in the opposite case than was intended to (#2871)"
This reverts commit 519dfd9117.
* Remove bad pushed commits
* Fixed spelling in core.py
* Pins pytest to the last py 3.6 version
* Add Text space
* Add Text space
* Added Text space
* Updated comment
* Allow Box automatic scalar shape
* Add test box and change default from () to (1,)
* Refactored conditional
* Refactored contains()
* update Box shape inference with more strict checking
* Update the box shape and add check on the custom Box shape
* Removed incorrect shape type and assert shape code
* Update the Box and associated tests
* Move dependency error to inside the atari environment
* Update the gym version to v0.25.0
* Fixed bugs in Text space and tests
* Code review by Drew
Co-authored-by: Ryan Rudes <ryanrudes@gmail.com>
* Update pyproject.toml
* Maybe fix typing for frozen lake and taxi
* Clean up pyproject a bit
* Reenable box2d pyright
* Disable box2d pyright
* Fix typing for toy text envs
* Narrow down pyright excludes for almost everything except mujoco
* Fix a wrapper test typing
* Remove env checker from excludes
* Remove redundant type hints which mess up pyright. And a typo fix.
* Remove test_spaces exclude
* Remove some redundant warnings
* Change pyright ignore to more specific
* Fix a weird private variable which gets explicitly exported for whatever reason. It's still exported for backwards compatibility, but internal code now uses a public variable.
* re-export the private variable
* Fix lunar_lander typing
* Remove lunar lander from excludes
* Small fix
* Allows a new RNG to be generated with seed=-1 and updated env_checker to fix bug if environment doesn't use np_random in reset
* Revert "fixed `gym.vector.make` where the checker was being applied in the opposite case than was intended to (#2871)"
This reverts commit 519dfd9117.
* Remove bad pushed commits
* Fixed spelling in core.py
* Pins pytest to the last py 3.6 version
* Allow Box automatic scalar shape
* Add test box and change default from () to (1,)
* update Box shape inference with more strict checking
* Update the box shape and add check on the custom Box shape
* Removed incorrect shape type and assert shape code
* Update the Box and associated tests
* Allows a new RNG to be generated with seed=-1 and updated env_checker to fix bug if environment doesn't use np_random in reset
* Revert "fixed `gym.vector.make` where the checker was being applied in the opposite case than was intended to (#2871)"
This reverts commit 519dfd9117.
* Remove bad pushed commits
* Fixed spelling in core.py
* Pins pytest to the last py 3.6 version
* Add support for action masking in Space.sample(mask=...)
* Fix action mask
* Fix action_mask
* Fix action_mask
* Added docstrings, fixed bugs and added taxi examples
* Fixed bugs
* Add tests for sample
* Add docstrings and test space sample mask Discrete and MultiBinary
* Add MultiDiscrete sampling and tests
* Remove sample mask from graph
* Update gym/spaces/multi_discrete.py
Co-authored-by: Markus Krimmel <montcyril@gmail.com>
* Updates based on Marcus28 and jjshoots for Graph.py
* Updates based on Marcus28 and jjshoots for Graph.py
* jjshoot review
* jjshoot review
* Update assert check
* Update type hints
Co-authored-by: Markus Krimmel <montcyril@gmail.com>
* Remove additional ignores from flake8
* Remove all unused imports
* Remove all unused imports
* Update flake8 and pyupgrade
* F841, removed unused variables
* E731, removed lambda assignment to variables
* Remove E731, F403, F405, F524
* Remove E722, bare exceptions
* Remove E712, compare variable == True or == False to is True or is False
* Remove E402, module level import not at top of file
* Added --pre-file-ignores
* Add --per-file-ignores removing E741, E302 and E704
* Add E741, do not use variables named ‘l’, ‘O’, or ‘I’ to ignore issues in classic control
* Fixed issues for pytest==6.2
* Remove unnecessary # noqa
* Edit comment with the removal of E302
* Added warnings and declared module, attr for pyright type hinting
* Remove unused import
* Removed flake8 E302
* Updated flake8 from 3.9.2 to 4.0.1
* Remove unused variable
* Updated cartpole-v0 to v1 to prevent warning and added pytest.mark.filterwarnings for tests where warnings are unavoidable
* Change np.bool to bool as numpy raises a warning and bool is the suggested solution
* Seeding randint is deprecated in the future, integers is new solution
* Fixed errors thrown when the video recorder is deleted but not closed
* spaces.Box expects a floating array, updated all cases where this was not true and modified float32 to float64 as float array default to float64. Otherwise space.Box raises warning that dtype precision (float32) is lower than array precision (float64).
* Added pytest.mark.filterwarnings to preventing the raising of an intended warning
* Added comment to explain why a warning is raised that can't be prevented without version update to the environment
* Added comment to explain why warning is raised
* Changed values to float as expected by the box which default to float64
* Removed --forked from pytest as the pytest-forked project is no being maintained and was not raising warnings as expected
* When AsyncVectorEnv has shared_memory=True then a ValueError is raised before _state is initialised. Therefore, on the destruction on the env an error is thrown in .close_extra as _state does not exist
* Possible fix that was causing an error in test_call_async_vector_env by ensuring that pygame resources are released
* Pygame throws an error with ALSA when closed, using a fix from PettingZoo (https://github.com/Farama-Foundation/PettingZoo/blob/master/pettingzoo/__init__.py). We use the dsp audiodriver to prevent this issue
* Modification due to running pre-commit locally
* Updated cartpole-v0 to v1 to prevent warning and added pytest.mark.filterwarnings for tests where warnings are unavoidable
* Change np.bool to bool as numpy raises a warning and bool is the suggested solution
* Seeding randint is deprecated in the future, integers is new solution
* Fixed errors thrown when the video recorder is deleted but not closed
* spaces.Box expects a floating array, updated all cases where this was not true and modified float32 to float64 as float array default to float64. Otherwise space.Box raises warning that dtype precision (float32) is lower than array precision (float64).
* Added pytest.mark.filterwarnings to preventing the raising of an intended warning
* Added comment to explain why a warning is raised that can't be prevented without version update to the environment
* Added comment to explain why warning is raised
* Changed values to float as expected by the box which default to float64
* Removed --forked from pytest as the pytest-forked project is no being maintained and was not raising warnings as expected
* When AsyncVectorEnv has shared_memory=True then a ValueError is raised before _state is initialised. Therefore, on the destruction on the env an error is thrown in .close_extra as _state does not exist
* Possible fix that was causing an error in test_call_async_vector_env by ensuring that pygame resources are released
* Pygame throws an error with ALSA when closed, using a fix from PettingZoo (https://github.com/Farama-Foundation/PettingZoo/blob/master/pettingzoo/__init__.py). We use the dsp audiodriver to prevent this issue
* Modification due to running pre-commit locally
* Fix flatten utils to handle Discrete.start
* Fix vector space utils to handle Discrete.start
* More granular dispatch in vector utils
* Fix Box including the high end of the interval
* gym.spaces.Tuple inherits from collections.abc.Sequence
Following the PR I did a few months back (https://github.com/openai/gym/pull/2446), the tuple wrapper of gym should inherits from the abstract interface of Python. It is important for type check via `isinstance` and enable using such objects transparently with libraries such as [dmtree](https://github.com/deepmind/tree).
It will bring a way helper methods along the way but it cannot be avoided to interoperability: : `__iter__`, `__reversed__`, `index`, and `count`
Personally I don't think it is an issue since it is new features and it is not conflicting.
As the previous PR, this patch is NOT removing any existing feature and should not break backward compatibility.
* Add unit test
* Fix unit tests
* Final fix.
* Remove irrelevant comment.
* Fix black formatter.
* Box Boundedness determined using get_inf instead of np.inf
* Store original array entries for determining boundedness
* Capture the boundedness before casting away the np.inf
* Removed requirement that integer spaces be bounded above and below
* np full casts away the inf, so using dtype float for boundedness evaluation
* Removed commented code
* But the type ignore hint back in
* Spacing change from black code formatter