Skip to main content

Common OpenAI Gym Wrappers

Project description

Wrap Your Gym!

PyPI GitHub Workflow Status (master) Coveralls github branch PyPI - Python Version PyPI - License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wrap_your_gym-0.0.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

wrap_your_gym-0.0.2-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page