37 Commits

Author SHA1 Message Date
Kallinteris Andreas
f20e3f4845 migrating the MuJoCo environments v2 and v3 to Gymnasium-Robotics (mujoco-py based) (#1392) 2025-06-07 15:26:04 +01:00
Mark Towers
1b2c1ff084 Fix pickle env testing (#1034) 2024-04-18 23:55:36 +01:00
Mark Towers
0fe94efa26 Fix OneOf shared memory and add pytest.skip to tests (#999) 2024-04-06 13:20:10 +01:00
Ariel Kwiatkowski
d43037920f Jax environment return jax data rather than numpy data (#817)
Co-authored-by: pseudo-rnd-thoughts <mark.m.towers@gmail.com>
2024-04-05 17:21:10 +01:00
Christopher Yeh
d9a8d66123 Update env_checker.py (#708) 2023-09-08 11:51:50 +01:00
Mark Towers
1bf58d8eb4 Remove warnings (#435)
Co-authored-by: Aaron Walsman <aaronwalsman@gmail.com>
2023-04-06 14:28:07 +01:00
Valentin
c5fd30e59e Reduce numbers of warnings in CI (#375) 2023-03-13 11:10:28 +00:00
Mark Towers
9e3200d000 Update EnvSpec and make to support reproducing the "whole" environment spec including wrappers (#292)
Co-authored-by: will <will2346@live.co.uk>
Co-authored-by: Will Dudley <14932240+WillDudley@users.noreply.github.com>
Co-authored-by: Mark Towers <marktowers@Marks-MacBook-Pro.local>
2023-02-24 11:34:20 +00:00
Mark Towers
4dd526d370 Reorder functions and refactor registration.py (#289)
Co-authored-by: Mark Towers <marktowers@Marks-MacBook-Pro.local>
2023-02-05 00:05:59 +00:00
Xuehai Pan
7e88559763 Update and rerun pre-commit hooks for better code quality (#179) 2022-12-04 14:24:02 +00:00
Mark Towers
e9f4655939 Test necessary imports (#146) 2022-12-01 12:18:01 +00:00
Ariel Kwiatkowski
34dfc9a728 Functional API and proof-of-concept jax classic-control envs (#25) (#145) 2022-11-18 21:25:33 +00:00
Mark Towers
31025e391b Update the type hinting for core.py (#39) 2022-11-12 10:21:24 +00:00
Markus Krimmel
1b067654e9 Added atari tests to CI, fixed test_gym_conversion that was failing due to missing ROMs (#87) 2022-11-01 11:55:38 +00:00
Markus Krimmel
24fd4a7512 Added Atari environments to tests, removed dead code (#78) 2022-10-26 21:41:39 +01:00
Mark Towers
8589523a77 Change import gymnasium to import gymnasium as gym (#20) 2022-09-16 23:41:27 +01:00
pseudo-rnd-thoughts
640c509109 Rename to gymnasium 2022-09-08 10:10:07 +01:00
Omar Younis
2f33096040 fix: restore auto human rendering (#3063)
* restore auto human rendering

* add assert for minimal modes
2022-09-05 15:56:36 -04:00
Mark Towers
799c8d20c1 Rename "rgb_array" to "rgb_array_list" and "single_rgb_array" to "rgb_array" (#3040)
* initial commit

* Fix CI

* Fixed CI

* third time the charm

* Fix mujoco environment render modes order

* Remove unnecessary changes

* pre-commit

* Fix tests

* Comment out test render modes

* Fix code review and readd mujoco

* pre-commit

* Fix testing envs

* Fix all GenericTestEnvs

* Do not run mujoco-py render environments
2022-09-01 09:06:42 -04:00
Mark Towers
ab3e02db83 Reduce the number of unexpected warnings during testing (#3050)
* Initial commit

* Remove unnecessary `warnings.simplefilters`

* Fix tests for new step API

* Fix testing

Co-authored-by: Markus28 <montcyril@gmail.com>
2022-08-30 14:47:26 -04:00
Arjun KG
54b406b799 Support only new step API (while retaining compatibility functions) (#3019) 2022-08-30 10:11:59 -04:00
John Balis
3a8daafce1 Removing return_info argument to env.reset() and deprecated env.seed() function (reset now always returns info) (#2962)
* removed return_info, made info dict mandatory in reset

* tenatively removed deprecated seed api for environments

* added more info type checks to wrapper tests

* formatting/style compliance

* addressed some comments

* polish to address review

* fixed tests after merge, and added a test of the return_info deprecation assertion if found in reset signature

* some organization of env_checker tests, reverted a probably merge error

* added deprecation check for seed function in env

* updated docstring

* removed debug prints, tweaked test_check_seed_deprecation

* changed return_info deprecation check from assertion to warning

* fixes to vector envs, now  should be correctly structured

* added some explanation and typehints for mockup depcreated return info reset function

* re-removed seed function from vector envs

* added explanation to _reset_return_info_type and changed the return statement
2022-08-23 11:09:54 -04:00
Ariel Kwiatkowski
51c2026f19 Fix unpickling Box2D and MuJoCo envs (#3025)
* Try to fix car racing unpickling

* Fix EzPickle for BipedalWalker and LunarLander

* Shamelessly steal the pickle-unpickle test from Mark, with slight modifications

* CarRacing EzPickle fix

* Mujoco ezpickle fix
2022-08-16 12:05:36 -04:00
Mark Towers
015b31fa76 Bug fix, add tests for environment checker and passive environment checker wrapper (#2903) 2022-07-10 21:45:24 -04:00
Mark Towers
ffbf971171 Rewrite env tests (#2867) 2022-06-16 09:29:13 -04:00
Omar Younis
9acf9cd367 Render API (#2671)
* 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

* add rgb_array support

* reformat

* test render api change on FrozenLake

* add render support for reset on frozenlake

* add clock on pygame render

* new render api for blackjack

* new render api for cliffwalking

* new render api for Env class

* update reset method, lunar and Env

* fix wrapper

* fix reset lunar

* new render api for box2d envs

* new render api for mujoco envs

* fix bug

* new render api for classic control envs

* fix tests

* add render_mode None for CartPole

* new render api for test fake envs

* pre-commit hook

* fix FrozenLake

* fix FrozenLake

* more render_mode to super - frozenlake

* remove kwargs from frozen_lake new

* pre-commit hook

* add deprecated render method

* add backwards compatibility

* fix test

* add _render

* move pygame.init() (avoid pygame dependency on init)

* fix pygame dependencies

* remove collect_render() maintain multi-behaviours .render()

* add type hints

* fix renderer

* don't call .render() with None

* improve docstring

* add single_rgb_array to all envs

* remove None from metadata["render_modes"]

* add type hints to test_env_checkers

* fix lint

* add comments to renderer

* add comments to single_depth_array and single_state_pixels

* reformat

* add deprecation warnings and env.render_mode declaration

* fix lint

* reformat

* fix tests

* add docs

* fix car racing determinism

* remove warning test envs, customizable modes on renderer

* remove commments and add todo for env_checker

* fix car racing

* replace render mode check with assert

* update new mujoco

* reformat

* reformat

* change metaclass definition

* fix tests

* implement mark suggestions (test, docs, sets)

* check_render

Co-authored-by: J K Terry <jkterry0@gmail.com>
2022-06-07 18:20:56 -04:00
Mark Towers
134de4a713 Updates the environment checker (#2864)
* Updated testing requirements based off extra["testing"]

* Updated setup to check the version is valid, added testing and all dependency groups and collects the requirements from requirements.txt to keep everything standardized.

* Updated requirements.txt based on the current minimum gym requirements.txt to work

* Updated requirements.txt based on the current minimum gym requirements.txt to work

* Updated test_requirements.txt based on the current gym full testing requirements

* Pre-commit updates

* Add integer check for the `n` parameter

* The type of self.spaces is an Iterable which is absorbed by the tuple.

* Simplifies the environment checker to two files, env_checker.py and passive_env_checker.py with a new wrapper env_checker.py

* Adds the passive environment checker on `gym.make`

* Ignore the `check_env` warn parameter

* Ignore the `check_env` warn parameter

* Use the `data_equivalence` function

* Revert rewrite setup.py changes

* Remove smart formatting for 3.6 support

* Fixed `check_action_space` and `check_observation_space`

* Added disable_env_checker to vector.make such that env_checker would only run on the first environment created.

* Removing check that different seeds would produce different initialising states

* Use the unwrapped environment np_random

* Fixed vector environment creator
2022-06-06 11:21:45 -04:00
Rodrigo de Lazcano
3e006f3ea5 Add new MuJoCo bindings (#2762) 2022-05-24 08:47:51 -04:00
Gianluca De Cola
350a082d2f Upgrade test_determinism. Refer to #2767 (#2814) 2022-05-12 09:33:48 -04:00
Mark Towers
bf093c6890 Update the flake8 pre-commit ignores (#2778)
* 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
2022-04-26 11:18:37 -04:00
Mark Towers
b7179241ec Update the parametrize to show the ids of the specification to make debugging easier (#2740) 2022-04-10 13:36:23 -04:00
Andrea PIERRÉ
e913bc81b8 Improve pre-commit workflow (#2602)
* feat: add `isort` to `pre-commit`

* ci: skip `__init__.py` file for `isort`

* ci: make `isort` mandatory in lint pipeline

* docs: add a section on Git hooks

* ci: check isort diff

* fix: isort from master branch

* docs: add pre-commit badge

* ci: update black + bandit versions

* feat: add PR template

* refactor: PR template

* ci: remove bandit

* docs: add Black badge

* ci: try to remove all `|| true` statements

* ci: remove lint_python job

- Remove `lint_python` CI job
- Move `pyupgrade` job to `pre-commit` workflow

* fix: avoid messing with typing

* docs: add a note on running `pre-cpmmit` manually

* ci: apply `pre-commit` to the whole codebase
2022-03-31 15:50:38 -04:00
Mark Towers
850247f888 Reduces warnings produced by pytest from ~1500 to 13 (#2660)
* 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
2022-03-14 10:27:03 -04:00
trigaten
35b78ac0ab Rename render modes/fps (#2654)
* Update pendulum.py

* version warnings

* black

* try except

* update notices version

* Exception

* nosec

* black

* no loop, stderr

* black

* convert ## to ###

* correct subheader

* black

* despace

* spacing

* frozen lake fixes

* rename render modes/fps

* fix API test

* fix API test

* fix more API tests

* black

* add render fps
2022-02-28 15:54:03 -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
Ilya Kamen
e9df493243 Py36+ code style in tests (#2547) 2022-01-11 12:12:05 -05:00
Ariel Kwiatkowski
947b857bd4 Test refactoring (#2427)
* Move tests to root with automatic PyCharm import refactoring. This will likely fail some tests

* Changed entry point for a registration test env.

* Move a stray lunar_lander test to tests/envs/...

* black

* Change the version from which importlib_metadata is replaced with importlib.metadata. Also requiring installing importlib_metadata for python 3.8 now.

???????????

* Undo last commit
2021-09-28 19:53:30 -04:00