Skip to main content

env-ssl-wrapper

One line turns any simulator's environment — gymnasium, dm_control, isaac, maniskill, pybullet, robosuite, pufferlib — into the same torch-native interface.

Install

pip install env-ssl-wrapper

Usage

import torch
from env_ssl_wrapper import compose_env

env = compose_env(
    any_env,                                 # any env from any sim
    ('tensor', dict(device='cpu')),          # wrap with whatever you need
    'done_tracker',
)

obs, info = env.reset()                      # torch.float32, batched
while not env.all_done:
    actions = torch.randint(0, 2, (8,))
    obs, reward, terminated, truncated, info = env.step(actions)

Works identically for every simulator.

Wrappers

Pass wrappers as strings (default config) or (name, dict) tuples (custom config), in any order.

Wrapper What it does
standardize Normalizes any sim's step/reset signatures, vectorization, and autoreset into (obs, reward, terminated, truncated, info). Applied automatically.
time_limit Caps episodes, sets truncated=True. ('time_limit', dict(max_timesteps=200))
done_tracker Tracks per-env episode_lengths, exposes env.all_done / env.needs_reset.
pad_episodes Standardizes padding for uneven vectorized episodes: done envs emit zeros (float/int) / False (bool) obs, and rewards are zeroed from the step after termination onward (the terminating step's own reward is the real terminal transition reward and is preserved). Applied automatically to vectorized envs. Works for autoreset (Isaac, gymnasium) and non-autoreset (pufferlib, maniskill) envs alike.
auto_batch Gives single envs a leading batch dim: (4,)(1, 4).
action_transform Rescales actions from a canonical (0, 1) range to the env's bounds.
tensor NumPy → torch on a device, torch actions → numpy for the sim.
flatten_obs Flattens dict/tuple observations into a single vector.

Every env emits the same contract: obs torch.float32, rewards torch.float32, terminated/truncated torch.bool. env.seed(n) works on every sim.

Terminated envs are uniformly padded (zeros / False obs; rewards zeroed only after the terminating step, so the terminal transition's reward is never lost), and info['final_observation'] — the true terminal obs, frozen per env and re-emitted while the env stays done — is always present once any env has terminated, with info['_final_observation'] masking which envs it applies to. env.is_done always reflects the per-env done mask.

Mock sims

env_ssl_wrapper.mocks ships dependency-free stand-ins emulating each simulator's quirks (GymnasiumMockEnv, IsaacMockEnv, DMControlMockEnv, ...) for testing your code without installing the real sims.

from env_ssl_wrapper.mocks import IsaacMockEnv
env = compose_env(IsaacMockEnv(), 'tensor', 'done_tracker')

Tests

uv sync --extra test
uv run pytest tests/test_real_envs.py

Download files

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

Source Distribution

env_ssl_wrapper-0.1.14.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

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

env_ssl_wrapper-0.1.14-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file env_ssl_wrapper-0.1.14.tar.gz.

File metadata

  • Download URL: env_ssl_wrapper-0.1.14.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for env_ssl_wrapper-0.1.14.tar.gz
Algorithm Hash digest
SHA256 f271a06b6a8f4ca4aa218ad79a2103f911350d1818e6bd2a7aa83b64724a641f
MD5 04fdae97b5d74d71efaf90e3b9a6739e
BLAKE2b-256 ea0eb0af6ed25f2e19f28d4adf29d912f0c98f1cdf2c825a5ef33bf1cd973e3f

See more details on using hashes here.

File details

Details for the file env_ssl_wrapper-0.1.14-py3-none-any.whl.

File metadata

File hashes

Hashes for env_ssl_wrapper-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c45d79f63b93db758cdb8e2d827e459e6dbb12251f2ec301631c5adec10a75aa
MD5 4ecf360e03ee53b20bd7c5168b82b33e
BLAKE2b-256 4768d4401240d9f2fc00ef4af3f2db7e6caf9c646bcc2d7ab043930933c07bbd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 files

0.1.11

2 files

0.1.10

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 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