Metadata-Version: 2.5
Name: POPJym
Version: 0.1.0
Summary: Pure JAX, JIT-compatible ports of the POPGym environments
Author: Zekang Wang
License: MIT License
        
        Copyright (c) 2026 Zekang Wang and Zhe He
        Copyright (c) 2022 Steven Morad (original POPGym implementation)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: jax>=0.4.30
Provides-Extra: reference
Requires-Dist: gymnax>=1.0.0; extra == 'reference'
Requires-Dist: popgym[navigation]==1.0.7; extra == 'reference'
Description-Content-Type: text/markdown

# POPJym

POPJym reimplements the environments from POPGym in pure JAX for experiments on memory in reinforcement learning. It includes 16 task families, each with Easy, Medium, and Hard settings (48 environments). Both `reset` and `step` support `jax.jit` and `jax.vmap`. [Original POPGym implementation](https://github.com/proroklab/popgym/tree/410d5aa626dae8024f498354d8781a0d1870c399)

## Comparison with popjaxrl

Chris Lu and colleagues released an earlier JAX implementation of POPGym in popjaxrl. POPJym restores several task rules from the original benchmark. [popjaxrl repository](https://github.com/luchris429/popjaxrl)

| Task | Earlier popjaxrl behavior (source) | POPJym behavior |
| --- | --- | --- |
| CountRecallEasy | The agent could answer only 0 or 1. [popjaxrl issue #10](https://github.com/luchris429/popjaxrl/issues/10) | The agent can report any count from 0 through 26. |
| Autoencode | [The agent saw a blank observation for every card during the watch phase.](https://github.com/luchris429/popjaxrl/blob/12e5d42be3a6bde81cce4234f8be4e119e4318b6/envs/environments/popgym_autoencode.py#L71-L77) | The agent sees each suit in order, then recalls the suits in reverse. |
| RepeatFirstEasy | [A 52-card deck allowed 52 guesses and a perfect return of 52/51.](https://github.com/luchris429/popjaxrl/blob/12e5d42be3a6bde81cce4234f8be4e119e4318b6/envs/environments/popgym_repeat_first.py#L33-L39) | The first card is dealt at reset, leaving 51 guesses and a perfect return of 1. |
| MineSweeper | [Clearing every safe square in succession left the episode running.](https://github.com/luchris429/popjaxrl/blob/12e5d42be3a6bde81cce4234f8be4e119e4318b6/envs/environments/popgym_minesweeper.py#L39-L53) | Clearing the last safe square ends the episode. |

## Quick start

```bash
python -m pip install "git+https://github.com/bolt-research/POPJym.git"
```

```python
import jax
import popjym

env = popjym.make("RepeatFirstEasy")
reset_key, step_key = jax.random.split(jax.random.key(0))
first_suit, state = env.reset(reset_key)
obs, state, reward, terminated, truncated, info = jax.jit(env.step)(
    step_key, state, first_suit
)
```

## Citation

If you use POPJym in your work, please cite this software and the original POPGym benchmark paper by Morad et al.

```bibtex
@software{wang2026popjym,
  author  = {Wang, Zekang and He, Zhe},
  title   = {{POPJym}},
  year    = {2026},
  version = {0.1.0},
  url     = {https://github.com/bolt-research/POPJym}
}
```

```bibtex
@inproceedings{morad2023popgym,
  author    = {Morad, Steven and Kortvelesy, Ryan and Bettini, Matteo and Liwicki, Stephan and Prorok, Amanda},
  title     = {{POPGym}: Benchmarking Partially Observable Reinforcement Learning},
  booktitle = {The Eleventh International Conference on Learning Representations},
  year      = {2023},
  url       = {https://openreview.net/forum?id=chDrutUTs0K}
}
```
