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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file wrap_your_gym-0.0.2.tar.gz.

File metadata

  • Download URL: wrap_your_gym-0.0.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for wrap_your_gym-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1e674a251b1a06cc41616dc8151cab214bc9811804b5be550e6be0b9e823742a
MD5 98d6f79b1c85c6f7bf0129e4fa683dbd
BLAKE2b-256 dbf91f035e51b41b5398ba23f67de55f95bab049ce8b351b0008921fbfad782d

See more details on using hashes here.

File details

Details for the file wrap_your_gym-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wrap_your_gym-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for wrap_your_gym-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 46d33071c15a66a6b4f1c9cacd645f2f980359a6d024372d8100cd384db066d3
MD5 05fa79931a41a815d23789abe5872cf7
BLAKE2b-256 d55e46648c6fe8a4dcae05624655135a44f5b3b5a552ecf76ef3c24b4dca9d55

See more details on using hashes here.

Supported by

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