Skip to content

Commit 2cf8f8e

Browse files
authored
Remove call to deprecated importlib find_loader (#31)
* remove call to deprecated importlib find_loader * bump version for release * edit readme for mazelib issue and add small example
1 parent 229f70c commit 2cf8f8e

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
name: isort (python)
1414
args: ["--profile", "black"]
1515
- repo: https://github.com/pycqa/flake8
16-
rev: 4.0.1
16+
rev: 7.0.0
1717
hooks:
1818
- id: flake8
1919
args:

README.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,24 @@ Please see the [documentation](https://popgym.readthedocs.io/en/latest/) for adv
99
## Quickstart Install
1010

1111
```python
12-
pip install popgym # base environments only, only requires numpy and gymnasium
13-
pip install --use-pep517 "popgym[navigation]" # also include navigation environments, which require mazelib
14-
pip install "popgym[baselines]" # environments and memory baselines
12+
# Install base environments, only requires numpy and gymnasium
13+
pip install popgym
14+
# Also include navigation environments, which require mazelib
15+
# NOTE: navigation envs require python <3.12 due to mazelib not supporting 3.12
16+
pip install "popgym[navigation]"
17+
# Install memory baselines w/ RLlib
18+
pip install "popgym[baselines]"
19+
```
20+
21+
## Quickstart Usage
22+
23+
```python
24+
import popgym
25+
from popgym.wrappers import PreviousAction, Antialias, Flatten, DiscreteAction
26+
env = popgym.envs.position_only_cartpole.PositionOnlyCartPoleEasy()
27+
print(env.reset(seed=0))
28+
wrapped = DiscreteAction(Flatten(PreviousAction(env))) # Append prev action to obs, flatten obs/action spaces, then map the multidiscrete action space to a single discrete action for Q learning
29+
print(wrapped.reset(seed=0))
1530
```
1631

1732
## POPGym Environments

popgym/envs/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33

44
import inspect
5-
from importlib import find_loader
5+
from importlib.util import find_spec
66
from typing import Any, Dict
77

88
import gymnasium as gym
@@ -255,7 +255,7 @@
255255
#
256256
def has_mazelib(): # noqa: E302
257257
"""Check if mazelib is installed"""
258-
return find_loader("mazelib") is not None
258+
return find_spec("mazelib") is not None
259259

260260

261261
if has_mazelib():

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = A collection of partially-observable procedural gym environments
44
long_description = file: README.md
55
long_description_content_type = text/markdown
66
author = Steven Morad
7-
version = 1.0.4
7+
version = 1.0.5
88
license = MIT
99
readme = README.md
1010
requires_python = >=3.7

0 commit comments

Comments
 (0)