Skip to main content

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.

Metadata

Release files for wrap-your-gym 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wrap-your-gym 0.0.2
File Size Uploaded
wrap_your_gym-0.0.2.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wrap-your-gym 0.0.2
File Interpreter ABI Platform
wrap_your_gym-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / wrap_your_gym-0.0.2.tar.gz

Download URL wrap_your_gym-0.0.2.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1e674a251b1a06cc41616dc8151cab214bc9811804b5be550e6be0b9e823742a
BLAKE2b-256 checksum
How to use checksums
dbf91f035e51b41b5398ba23f67de55f95bab049ce8b351b0008921fbfad782d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / wrap_your_gym-0.0.2-py3-none-any.whl

Download URL wrap_your_gym-0.0.2-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46d33071c15a66a6b4f1c9cacd645f2f980359a6d024372d8100cd384db066d3
BLAKE2b-256 checksum
How to use checksums
d55e46648c6fe8a4dcae05624655135a44f5b3b5a552ecf76ef3c24b4dca9d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page