Skip to content

Commit a5182a4

Browse files
Fix ci (#127)
1 parent 3135095 commit a5182a4

25 files changed

+43
-47
lines changed

.github/workflows/build-docs-dev.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
- uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.9'
18+
python-version: '3.11'
1919

2020
- name: Install dependencies for doc
2121
run: pip install -r docs/requirements.txt

.github/workflows/build-docs-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: actions/setup-python@v5
1818
with:
19-
python-version: '3.9'
19+
python-version: '3.11'
2020

2121
- name: Get tag
2222
id: tag

.github/workflows/build-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Python
2424
uses: actions/setup-python@v5
2525
with:
26-
python-version: '3.7'
26+
python-version: '3.12'
2727
- name: Install dependencies
2828
run: python -m pip install --upgrade setuptools wheel build
2929
- name: Build wheels

.github/workflows/manual-build-docs-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- uses: actions/setup-python@v5
3333
with:
34-
python-version: '3.9'
34+
python-version: '3.11'
3535

3636
- name: Install dependencies for doc
3737
run: pip install -r docs/requirements.txt

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-symlinks
88
- id: destroyed-symlinks
@@ -20,17 +20,17 @@ repos:
2020
- id: mixed-line-ending
2121
args: [ "--fix=lf" ]
2222
- repo: https://github.com/python/black
23-
rev: 23.3.0
23+
rev: 24.10.0
2424
hooks:
2525
- id: black
2626
- repo: https://github.com/codespell-project/codespell
27-
rev: v2.2.4
27+
rev: v2.3.0
2828
hooks:
2929
- id: codespell
3030
args:
3131
- --ignore-words-list=reacher
3232
- repo: https://github.com/PyCQA/flake8
33-
rev: 6.0.0
33+
rev: 7.1.1
3434
hooks:
3535
- id: flake8
3636
args:
@@ -40,12 +40,12 @@ repos:
4040
- --show-source
4141
- --statistics
4242
- repo: https://github.com/PyCQA/isort
43-
rev: 5.12.0
43+
rev: 5.13.2
4444
hooks:
4545
- id: isort
4646
args: ["--profile", "black"]
4747
- repo: https://github.com/asottile/pyupgrade
48-
rev: v3.3.2
48+
rev: v3.19.1
4949
hooks:
5050
- id: pyupgrade
5151
args: ["--py38-plus"]

bin/dm_lab.Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
99

1010
RUN pip install --upgrade pip
1111

12+
RUN python --version
13+
1214
# Install Shimmy requirements
1315
RUN apt-get -y update \
1416
&& apt-get install --no-install-recommends -y \

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Setups up the Shimmy module."""
2+
23
from setuptools import find_packages, setup
34

45

@@ -33,8 +34,8 @@ def get_version():
3334
header_count, long_description = get_description()
3435

3536
extras = {
36-
"gym-v21": ["gym>=0.21.0,<0.26", "pyglet==1.5.11"],
37-
"gym-v26": ["gym>=0.26.2"],
37+
"gym-v21": ["gym>=0.21.0,<0.26", "pyglet==1.5.11", "numpy<2.0"],
38+
"gym-v26": ["gym>=0.26.2", "numpy<2.0"],
3839
# "imageio" should be "gymnasium[mujoco]>=0.26" but there are install conflicts
3940
"dm-control": ["dm-control>=1.0.10", "imageio", "h5py>=3.7.0"],
4041
"dm-control-multi-agent": [
@@ -72,7 +73,7 @@ def get_version():
7273
keywords=["Reinforcement Learning", "game", "RL", "AI"],
7374
python_requires=">=3.8",
7475
packages=find_packages(),
75-
install_requires=["numpy>=1.18.0", "gymnasium>=1.0.0a1"],
76+
install_requires=["numpy>=1.18.0", "gymnasium>=1.0.0"],
7677
tests_require=extras["testing"],
7778
extras_require=extras,
7879
classifiers=[

shimmy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""API for converting popular non-gymnasium environments to a gymnasium compatible environment."""
2+
23
from __future__ import annotations
34

45
from typing import Any

shimmy/bsuite_compatibility.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Wrapper to convert a BSuite environment into a gymnasium compatible environment."""
2+
23
from __future__ import annotations
34

45
from typing import Any

shimmy/dm_control_compatibility.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
https://github.com/ikostrikov/dmcgym/blob/main/dmcgym/env.py
55
and modified to modern gymnasium API
66
"""
7+
78
from __future__ import annotations
89

910
import math

shimmy/dm_control_multiagent_compatibility.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Wrapper to convert a dm_env multiagent environment into a pettingzoo compatible environment."""
2+
23
from __future__ import annotations
34

45
import functools
@@ -19,9 +20,7 @@
1920
from dm_control.locomotion import soccer as dm_soccer
2021

2122

22-
def _unravel_ma_timestep(
23-
timestep: dm_env.TimeStep, agents: list[AgentID]
24-
) -> tuple[
23+
def _unravel_ma_timestep(timestep: dm_env.TimeStep, agents: list[AgentID]) -> tuple[
2524
dict[AgentID, Any],
2625
dict[AgentID, float],
2726
dict[AgentID, bool],
@@ -247,9 +246,7 @@ def reset(
247246

248247
return observations, info
249248

250-
def step(
251-
self, actions: ActionDict
252-
) -> tuple[
249+
def step(self, actions: ActionDict) -> tuple[
253250
ObsDict,
254251
dict[AgentID, float],
255252
dict[AgentID, bool],

shimmy/dm_lab_compatibility.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Wrapper to convert a DM Lab environment into a gymnasium compatible environment."""
2+
23
# pyright: reportOptionalMemberAccess=false
34
from __future__ import annotations
45

shimmy/meltingpot_compatibility.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
https://github.com/deepmind/meltingpot/blob/main/examples/pettingzoo/utils.py
55
and modified to modern PettingZoo API
66
"""
7+
78
# pyright: reportOptionalSubscript=false
89
from __future__ import annotations
910

shimmy/openai_gym_compatibility.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Compatibility wrappers for OpenAI gym V21 and V26."""
2+
23
# pyright: reportGeneralTypeIssues=false, reportPrivateImportUsage=false
34
from __future__ import annotations
45

shimmy/openspiel_compatibility.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def _choose_next_agent(self):
326326
return
327327
else:
328328
# ignore agents where there are no valid actions
329-
# this will raise assertations with PZ api
329+
# this will raise assertions with PZ api
330330
self.simultaneous_actions[agent] = None
331331
return
332332

shimmy/utils/dm_control_multiagent.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility functions for DM Control Multi-Agent."""
2+
23
from __future__ import annotations
34

45
from typing import TYPE_CHECKING
@@ -35,13 +36,13 @@ def load_dm_control_soccer(
3536
env = dm_soccer.load(
3637
team_size=team_size if team_size is not None else 2,
3738
time_limit=time_limit if time_limit is not None else 10.0,
38-
disable_walker_contacts=disable_walker_contacts
39-
if disable_walker_contacts is not None
40-
else False,
39+
disable_walker_contacts=(
40+
disable_walker_contacts if disable_walker_contacts is not None else False
41+
),
4142
enable_field_box=enable_field_box if enable_field_box is not None else True,
4243
terminate_on_goal=terminate_on_goal if terminate_on_goal is not None else False,
43-
walker_type=walker_type
44-
if walker_type is not None
45-
else dm_soccer.WalkerType.BOXHEAD,
44+
walker_type=(
45+
walker_type if walker_type is not None else dm_soccer.WalkerType.BOXHEAD
46+
),
4647
)
4748
return env

shimmy/utils/dm_env.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility functions for the compatibility wrappers."""
2+
23
from __future__ import annotations
34

45
import copy

shimmy/utils/dm_lab.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility functions for the compatibility wrappers."""
2+
23
from __future__ import annotations
34

45
from collections import OrderedDict

shimmy/utils/meltingpot.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utility functions for Melting Pot."""
2+
23
# pyright: reportGeneralTypeIssues=false
34
# flake8: noqa F821
45
import dm_env

tests/test_bsuite.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the functionality of the BSuiteCompatibilityV0 on bsuite envs."""
2+
23
import pickle
34
import warnings
45

tests/test_dm_control.py

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the functionality of the DmControlCompatibility Wrapper on dm_control envs."""
2+
23
import pickle
34
import warnings
45
from typing import Callable
@@ -37,37 +38,17 @@ def test_dm_control_suite_envs():
3738
assert dm_control.suite.ALL_TASKS == DM_CONTROL_SUITE_ENVS
3839

3940

40-
# todo - gymnasium v27 should remove the need for some of these warnings
4141
CHECK_ENV_IGNORE_WARNINGS = [
4242
f"\x1b[33mWARN: {message}\x1b[0m"
4343
for message in [
4444
"A Box observation space minimum value is -infinity. This is probably too low.",
4545
"A Box observation space maximum value is infinity. This is probably too high.",
4646
"For Box action spaces, we recommend using a symmetric and normalized space (range=[-1, 1] or [0, 1]). See https://stable-baselines3.readthedocs.io/en/master/guide/rl_tips.html for more information.",
47-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: ()",
48-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (8, 2)",
49-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (2, 4)",
50-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (4, 4)",
51-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 3)",
52-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 84, 84, 3)",
53-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 2)",
54-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 6)",
55-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 4)",
56-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 9)",
57-
"A Box observation space has an unconventional shape (neither an image, nor a 1D vector). We recommend flattening the observation to have only a 1D vector or use a custom policy to properly process the data. Actual observation shape: (1, 5)",
58-
"It seems a Box observation space is an image but the `dtype` is not `np.uint8`, actual type: float64. If the Box observation space is not an image, we recommend flattening the observation to have only a 1D vector.",
59-
"It seems a Box observation space is an image but the upper and lower bounds are not in [0, 255]. Generally, CNN policies assume observations are within that range, so you may encounter an issue if the observation values are not.",
60-
"arrays to stack must be passed as a 'sequence' type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.",
6147
"Calling `env.close()` on the closed environment should be allowed, but it raised an exception: _data",
6248
"Calling `env.close()` on the closed environment should be allowed, but it raised an exception: 'Physics' object has no attribute '_data'",
6349
]
6450
]
65-
CHECK_ENV_IGNORE_WARNINGS.append(
66-
'arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.',
67-
)
68-
CHECK_ENV_IGNORE_WARNINGS.append(
69-
"Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)"
70-
)
51+
CHECK_ENV_IGNORE_WARNINGS.append("`in1d` is deprecated. Use `np.isin` instead.")
7152

7253

7354
@pytest.mark.parametrize("env_id", DM_CONTROL_ENV_IDS)

tests/test_dm_control_multi_agent.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the multi-agent dm-control soccer environment."""
2+
23
import pickle
34

45
import pytest

tests/test_dm_lab.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the multi-agent dm-control soccer environment."""
2+
23
# pyright: reportUndefinedVariable=false
34
# flake8: noqa F821
45
import pickle

tests/test_meltingpot.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the functionality of the MeltingPotCompatibility wrapper on meltingpot substrates."""
2+
23
# pyright: reportUndefinedVariable=false
34
# flake8: noqa F821 E402
45
# isort: skip_file

tests/test_openspiel.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the functionality of the OpenSpielCompatibility wrapper on OpenSpiel envs."""
2+
23
# pyright: reportGeneralTypeIssues=false
34
import pickle
45

0 commit comments

Comments
 (0)