Common OpenAI Gym Wrappers
Project description
Wrap Your Gym!
Common OpenAI gym wrappers found during my journeys. This repository collects a multitude of wrappers that I needed for my own implementation or extracted from other research repositories.
Why create this repository? As most research implementations opt for changing environment implementations instead of wrappers, it gets very complicated to replace the originally used environment. This repository extracts all modifications to the environment and makes it possible to just plug and play a custom environment with a multitude of wrappers. I hope, that this convinces other researchers of the benefit of wrappers and changes the way we implement environments in the long run.
OpenAI Gym Compatibility
This package uses the new Gym API where it is necessary to use one specific API. While most wrappers should be usable with the old API, an easy fix is the usage of the StepAPICompability wrapper implemented in Gym. E.g.
from gym.wrappers import StepAPICompability
from wrap_your_gym import ResetObs
env = ... # Your Env
env = StepAPICompability(env, truncated_bool=True)
env = ResetObs(env) # or another wrapper
env = StepAPICompability(env, truncated_bool=False) # depending on the API your code was implemented for
Requirements
- Python 3.7.0 or newer
- Gym (obviously)
- Numpy
- For the torch module: PyTorch
Installation
pip install wrap-your-gym
Development
This project uses poetry for packaging and managing all dependencies and pre-commit to run flake8, isort, mypy and black.
Additionally, pdbpp and better-exceptions
are installed to provide a better debugging experience.
To enable better-exceptions
you have to run export BETTER_EXCEPTIONS=1
in your current session/terminal.
Clone this repository and run
poetry install
poetry run pre-commit install
to create a virtual environment containing all dependencies. Afterwards, You can run the test suite using
poetry run pytest
This repository follows the Conventional Commits style.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wrap_your_gym-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46d33071c15a66a6b4f1c9cacd645f2f980359a6d024372d8100cd384db066d3 |
|
MD5 | 05fa79931a41a815d23789abe5872cf7 |
|
BLAKE2b-256 | d55e46648c6fe8a4dcae05624655135a44f5b3b5a552ecf76ef3c24b4dca9d55 |