Commit Graph

74 Commits

Author SHA1 Message Date
Jet
c6deb81ad3 Add mild domain randomization to Car Racing Env (#2749)
* first commit domain randomize

* black

* update doc

* add some type hints and internalized some functions

* we were told, the black bear is innocent; but I should not like to trust
myself wit him

* Don't need two color conventions

* don't multiply twice

* hardcore -> domain_randomize & register

* remove rogue decorator
2022-04-15 11:04:24 -04:00
John Balis
d4cda255ea AutoResetWrapper integration with gym.make() (#2728)
* added autoreset wrapper and tests

* added basic inline documentation for autoreset wrapper

* changes to comply with flake8 style

* redid autoreset wrapper

* compliance with flake8

* added final_info to info

* removed unnecessary override from autoreset wrapper

* fixed ordering mistake

* fixed flake8 compliance

* improved clarify of inline documentation

* changes to address code review

* changed autoreset terminal state keys, added message to key overlap check assert statement, updated autoreset wrapper docstring

* auto-reset integration draft

* changed arg name to autoreset for consistency

* pre commit compliance

* formatting compliance

* addressed code review

* removed commented out line
2022-04-08 10:54:49 -04:00
Markus Krimmel
bfdd2596af Changed reward_threshold from int to float (#2735) 2022-04-06 15:14:12 -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
Ilya Kamen
27108c98d9 Add types to gym.make("CartPole-v1") and such (#2594)
* Add typing to gym.make via literals

* Fix for type object not subscriptable

* Use Env[ObsType, ActType] instead of specific types to account for wrapping

* Move make and all overloads to `registration.py`

* Hack around py37 typing checks
2022-02-16 12:29:24 -05:00
Ilya Kamen
cf634bb444 Add typing to Wrapper signatures (#2590) 2022-02-05 11:25:47 -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
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
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
Jesse Farebrother
a30568a06e plugins: Remove allow-list for registering environments in the root namespace (#2530) 2021-12-20 01:55:55 -05:00
Jesse Farebrother
3f5b46dfc1 Add warnings when using outdated versions of environments (#2481)
This introduces a new tree-like storage structures for environments
which allows for efficient lookups of what versions of an environment
are registered. Using this new data-structure we can give warnings
to users about outdated environments when `make` is called.
2021-11-20 10:43:36 -05:00
Elijah K
eec6167440 Py36+ syntax in gym/envs: derived by running pyupgrade --py36-plus gym/envs/**.py and flynt gym --ll 120 (#2465)
Co-authored-by: Ilya Kamen <ilya.kamenshchikov@bosch.com>
2021-11-13 19:53:32 -05:00
Jesse Farebrother
ca42b05243 Fix importlib-metadata on Python 3.8 + bump ale-py (#2428)
* Bump ale-py -> 0.7.1

* env-plugins: parse module,attr for Python 3.8
2021-09-28 19:45:01 -04:00
Jesse Farebrother
5a4709b158 Env plugins, remove gym.envs.internal and replace with __internal__ key (#2409) 2021-09-16 10:23:32 -04:00
Ahmed Omar
2754d9737e removed calls to reset from init (#2394)
* removed all calls to reset

* passing tests

* fix off-by-one error

* revert

* merge master into branch

* add OrderEnforcing Wrapper

* add orderenforcing to the docs

* add option for disabling

* add argument to EnvSpec
2021-09-16 10:16:49 -04:00
Jesse Farebrother
e212043a93 Add plugin system for third-party environments (#2383) 2021-09-14 22:14:05 -04:00
Rohan138
c00c1babb9 Remove unused toytext environments (#2384)
* Moved Unused ToyText Environments

* Fixed error message

* removed KellyCoinFlip test

removed KellyCoinFlip tests

removed KellyCoinFlip tests

* black

* Modified docs
2021-09-01 23:22:01 -04:00
Rohan138
a7b6462136 Updated registration.py (#2375)
* Updated registration.py

* Blacken
2021-09-01 14:27:01 -04:00
J K Terry
150404104a Move Algorithmic Environments to Third Party Repo (#2344)
* try removing algorithmic environments

* fix tests

* algorithmic environments

* Moved algorithmic environments (#2363)

* Moved algorithmic environments

Moved algorithmic environments

Moved algorithmic environments

* blacken

* remove bad link

Co-authored-by: Rohan138 <66227218+Rohan138@users.noreply.github.com>
2021-08-27 09:48:24 -04:00
J K Terry
78d2b512d8 redo black (#2272) 2021-07-29 15:39:42 -04:00
Justin Terry
e9d2c41f2b redo black 2021-07-29 12:42:48 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
Diego Ferigo
10f3ffe680 Update stored spec object with kwargs (#1866)
* Update stored spec object with kwargs

* Add unit test
2020-04-24 16:49:41 -05:00
Christian Clauss
b7bd6bd1cc Typo: enviroment --> environment (#1828)
* Typo: enviroment --> environment

* Typo: information does not have a plural form in English
2020-03-06 16:37:23 -05:00
Xingdong Zuo
a99e8d153e [Update registration.py]: Clean-up of unused arguments (#1626)
* Update registration.py

* Update registration.py
2019-12-06 16:04:44 +01:00
Jesse Farebrother
dc91f434f8 Expose entry_point on EnvSpec 2019-07-19 14:36:57 -07:00
Julian Stastny
239aaf14ce Update registration.py (#1475) 2019-05-24 15:55:40 -07:00
Xingdong Zuo
c7bae99a06 [Update registration.py]: Remove unused args (#1429)
* Update registration.py

* Update registration.py
2019-04-26 14:30:14 -07:00
Xingdong Zuo
85a5372a19 [Update time_limit.py]: explicit information to distinguish done by passing limit (#1402)
* Update time_limit.py

* Update time_limit.py

* Update time_limit.py

* Update time_limit.py

* Update registration.py

* Update registration.py

* Update time_limit.py

* Update time_limit.py

* Update time_limit.py

* Update time_limit.py
2019-04-19 14:20:26 -07:00
iory
c6a3dedc4b [envs/registration.py] Fixed import module (#1398)
* [envs/registration.py] Fixed warnings import

* [envs/registration.py] Fixed ModuleNotFounderror

* [envs/registration.py] Modified ModuleNotFoundError to ImportError for python2.7
2019-03-23 14:27:58 -07:00
pzhokhov
93c5ca0d3d fixes #1066 (#1379) 2019-03-18 13:02:22 -07:00
Christopher Hesse
c34716645a import modules when specified to gym.make (#1344)
* import modules when specified to gym.make

* update docs
2019-03-08 14:50:32 -08:00
Kohki Mametani
72e3f9d32f Fixed typo (#656) 2019-03-07 12:21:57 -08:00
Greg Brockman
812c46cbad Support kwargs in gym.make and export register (#1301)
* Support kwargs in gym.make

We avoided adding kwargs for a long time in order to encourage people
to statically register their environment definitions. However, over
time we've found a few important use-cases for kwargs, such as:

- Runtime-specific objects, such as which GPU to run the environment
  on
- Parametrized environments, which can have an infinite number of meaningful
  variants

The latter breaks the invariant that the environment ID alone
determines the semantics of the environment, but it's an advanced
use-case and such users should be able to manage this on their own.

* Export the register method so it's easier for external users to register environments

* Improve kwargs test
2019-01-29 13:37:43 -08:00
Evgeniy Zheltonozhskiy
dc27a6f0a1 Replace deprecated load(False) with resolve() (#942) 2018-11-28 08:25:27 -08:00
Vitchyr Pong
10e53654cd Support kwargs for callable entry point (#1162) 2018-09-16 08:41:01 -07:00
Greg Brockman
28df2b1a21 Speed up time for import gym (#1020)
* Improve default import time from 750ms -> 73ms on 2016 Macbook pro

* Support code which expects gym.spaces.foo to work without a direct import of gym.spaces
2018-05-04 09:24:30 -07:00
Greg Brockman
1f4f625831 Add _gym_disable_underscore_compat to force-disable compatibility mode (#957)
Advanced users may have their own _step/_reset methods
2018-03-18 17:49:39 -07:00
John Schulman
4c460ba6c8 Cleanup, removal of unmaintained code (#836)
* add dtype to Box

* remove board_game, debugging, safety, parameter_tuning environments

* massive set of breaking changes
- remove python logging module
- _step, _reset, _seed, _close => non underscored method
- remove benchmark and scoring folder

* Improve render("human"), now resizable, closable window.

* get rid of default step and reset in wrappers, so it doesn’t silently fail for people with underscore methods

* CubeCrash unit test environment

* followup fixes

* MemorizeDigits unit test envrionment

* refactored spaces a bit
fixed indentation
disabled test_env_semantics

* fix unit tests

* fixes

* CubeCrash, MemorizeDigits tested

* gym backwards compatibility patch

* gym backwards compatibility, followup fixes

* changelist, add spaces to main namespaces

* undo_logger_setup for backwards compat

* remove configuration.py
2018-01-25 18:20:14 -08:00
John Schulman
5af5b7958a allow registering a callable 2017-09-18 11:25:39 -07:00
John Schulman
2b30434d14 Make sure env.spec always exists and is valid. (#621)
* Make sure env.spec always exists and is valid. Previously there was an error when you tried to get the string representation of an unregistered env.

* update changelist
2017-06-16 16:35:03 -07:00
Trevor Blackwell
2a0a2a3a2b Forward spec down the tree, rather than copy at init time, since it can be set after wrapping 2017-03-09 18:16:26 -08:00
Tom Brown
d337f4e571 TimeLimit refactor with Monitor Simplification (#482)
* fix double reset, as suggested by @jietang

* better floors and ceilings

* add convenience methods to monitor

* add wrappers to gym namespace

* allow playing Atari games, with potentially more coming in the future

* simplify example in docs

* Move play out of the Env

* fix tests

* no more deprecation warnings

* remove env.monitor

* monitor simplification

* monitor simplifications

* monitor related fixes

* a few changes suggested by linter

* timestep_limit fixes

* keep track of gym env variables for future compatibility

* timestep_limit => max_episode_timesteps

* don't apply TimeLimit wrapper in make for VNC envs

* Respect old timestep_limit argument

* Pass max_episode_seconds through registration

* Don't include deprecation warnings yet
2017-02-01 13:10:59 -08:00
Tom Brown
4cec14144b Add setter for backwards compat (#446)
* Add setter for backwards compat

* Fix ordering and preserver backwards compat
2016-12-28 15:38:55 -08:00
Tom Brown
133f1fdfdf Add timestep_limit property to EnvSpec to preserver backwards compat 2016-12-28 15:16:42 -08:00
Tom Brown
68c66b9a00 Kill timestep_limit 2016-12-28 13:08:47 -08:00
Greg Brockman
53c074ab3b Add period to valid env IDs 2016-11-11 21:09:25 -08:00