Ninetails
A wrapper for creating vectorized gymnasium environments.
Installation
pip3 install ninetails
Usage
import gymnasium as gym
import numpy as np
from ninetails import SubProcessVectorGymnasiumEnv
def main() -> None:
"""main.
Returns:
None:
"""
# define your environment using a function that returns the environment here
env_fns = [lambda i=i: gym.make("MountainCarContinuous-v0") for i in range(4)]
# create a vectorized environment
# `strict` is useful here for debugging
vec_env = SubProcessVectorGymnasiumEnv(env_fns=env_fns, strict=True)
# define our initial termination and trunction arrays
terminations, truncations = np.array([False]), np.array([False])
# reset follows the same signature as a Gymnasium environment
observations, infos = vec_env.reset(seed=42)
for step_count in range(5000):
# sample an action, this is an np.ndarray of [num_envs, *env.action_space.shape]
actions = vec_env.sample_actions()
# similarly, the step function follows the same signature as a Gymnasium environment with the following shapes
# observations: np.ndarray of shape [num_envs, *env.observation_space.shape]
# rewards: np.ndarray of shape [num_envs, 1]
# terminations: np.ndarray of shape [num_envs, 1]
# truncations: np.ndarray of shape [num_envs, 1]
# infos: tuple[dict[str, Any]]
observations, rewards, terminations, truncations, infos = vec_env.step(actions)
# to reset underlying environments
done_ids = set(terminations.nonzero()[0].tolist() + truncations.nonzero()[0].tolist())
for id in done_ids:
# warning, you'll have to handle starting observations yourself here
reset_obs, reset_info = vec_env.reset(id)
if __name__ == "__main__":
main()
Metadata
Release files for ninetails 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ninetails-0.0.9.tar.gz | 8.1 kB | Without provenance | Details for ninetails-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ninetails-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for ninetails-0.0.9-py3-none-any.whl |
Total release size: 17.2 kB
Release files / ninetails-0.0.9.tar.gz
| Download URL | ninetails-0.0.9.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6680b29a39412503990f9388b1c2244fdeaf7650106a763d46338fd91c3cd42
|
|
BLAKE2b-256 checksum How to use checksums |
5a4d77fd50fc44d24a6e3e2da4a130be19e84b51c6103bec5df96a9ff49fe8a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / ninetails-0.0.9-py3-none-any.whl
| Download URL | ninetails-0.0.9-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de51c261537be24fcc960a2a3e9398c825ca0e12cb7564855da0aa11935a701e
|
|
BLAKE2b-256 checksum How to use checksums |
4e97c0ef2fd744c3b75317737aa4476aa7fabe783bd6660c1f8f9799148bb5b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for ninetails 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.