Installation¶
Requirements¶
PGTG currently requires Python 3.11, 3.12, or 3.13.
All dependencies are fetched and installed automatically.
Install from PyPI¶
PGTG is published on PyPI and can be installed using the package manager of your liking:
Install from source¶
Clone the repository and install it in editable mode:
Optional extras¶
The optional dependency groups are exposed as extras:
| Extra | Installs | Use for |
|---|---|---|
docs |
MkDocs Material + mkdocstrings + ruff | Building this documentation |
dev |
pytest, pre-commit, ruff, marimo | Running tests and the pre-commit hooks |
examples |
marimo, Stable-Baselines3, torch, PyDSMC | Running the example notebooks |
all |
everything above | A complete development environment |
For development, we recommend installing all extras with:
Using mise (recommended for development)¶
The repository ships a mise configuration that pins versions and provides tasks for the common workflows, such as:
mise run install # create the venv and install the .[all] extra
mise run test # run the test suite
mise run docs # build the documentation (add --serve for live-reload)
mise run notebook <example-notebook> # defaults to explore_pgtg.py
See Contributing for the full development workflow.
Verify the installation¶
import gymnasium as gym
import pgtg
gym.register_envs(pgtg) # no-op; registering as an import side-effect
print(pgtg.__version__)
env = gym.make("pgtg-v5")
print(env.reset(seed=0)[0].keys()) # dict_keys(['position', 'velocity', 'map'])
Importing registers the environment
PGTG registers its environments as an import side-effect.
You have to import pgtg (even if you never reference it directly).
You can call gym.register_envs(pgtg) to prevent your formatter from removing the unused import.