Skip to content

Commit 5ac5492

Browse files
authored
Merge pull request #62 from Farama-Foundation/chore/update-hooks
Update actions and pre commit
2 parents f6c3095 + 12230d7 commit 5ac5492

33 files changed

+62
-26
lines changed

.github/workflows/build-publish.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ jobs:
2323
- uses: actions/setup-python@v5
2424

2525
- name: Install dependencies
26-
run: python -m pip install --upgrade pip setuptools build
27-
26+
run: pipx install build
2827
- name: Build sdist and wheels
29-
run: python -m build
30-
28+
run: pyproject-build
3129
- name: Store wheels
3230
uses: actions/upload-artifact@v4
3331
with:

.github/workflows/pre-commit.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
pre-commit:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v4
18-
- run: python -m pip install pre-commit
19-
- run: python -m pre_commit --version
20-
- run: python -m pre_commit install
21-
- run: python -m pre_commit run --all-files
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
- run: pipx install pre-commit
19+
- run: pre-commit run --all-files

.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.5.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-symlinks
88
- id: destroyed-symlinks
@@ -17,13 +17,13 @@ repos:
1717
- id: detect-private-key
1818
- id: debug-statements
1919
- repo: https://github.com/codespell-project/codespell
20-
rev: v2.2.6
20+
rev: v2.3.0
2121
hooks:
2222
- id: codespell
2323
args:
2424
- --ignore-words-list=reacher, mor, nowe
2525
- repo: https://github.com/PyCQA/flake8
26-
rev: 6.1.0
26+
rev: 7.1.1
2727
hooks:
2828
- id: flake8
2929
args:
@@ -34,16 +34,16 @@ repos:
3434
- --show-source
3535
- --statistics
3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v3.15.0
37+
rev: v3.18.0
3838
hooks:
3939
- id: pyupgrade
4040
args: ["--py37-plus"]
4141
- repo: https://github.com/PyCQA/isort
42-
rev: 5.12.0
42+
rev: 5.13.2
4343
hooks:
4444
- id: isort
4545
- repo: https://github.com/python/black
46-
rev: 23.9.1
46+
rev: 24.10.0
4747
hooks:
4848
- id: black
4949
- repo: https://github.com/pycqa/pydocstyle

momaland/envs/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Environment modules for momaland."""
2+
23
import momaland.envs.beach

momaland/envs/beach/mobeach_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Beach domain environment for multi-objective optimization."""
2+
23
from momaland.envs.beach.beach import env, parallel_env, raw_env
34

45

momaland/envs/breakthrough/breakthrough.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| Observation Values | [0,1] |
1212
| Reward Shape | (num_objectives=4,) |
1313
"""
14+
1415
from __future__ import annotations
1516

1617
from typing_extensions import override

momaland/envs/breakthrough/mobreakthrough_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Breakthrough environment with multiple objectives."""
2+
23
from momaland.envs.breakthrough.breakthrough import env, raw_env
34

45

momaland/envs/connect4/connect4.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| Observation Values | [0,1] |
1212
| Reward Shape | (2,) or (2+board_width,) |
1313
"""
14+
1415
from __future__ import annotations
1516

1617
import os

momaland/envs/connect4/moconnect4_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Connect 4 environment with multiple objectives."""
2+
23
from momaland.envs.connect4.connect4 import env, raw_env
34

45

momaland/envs/crazyrl/catch/catch_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""CrazyRL/Catch environment for MOMARL."""
2+
23
from momaland.envs.crazyrl.catch.catch import env, parallel_env, raw_env
34

45

momaland/envs/crazyrl/crazyRL_base.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Base environment inheriting from pettingZoo Parallel environment class."""
2+
23
from copy import copy
34
from typing import Optional
45
from typing_extensions import override

momaland/envs/crazyrl/escort/escort_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""CrazyRL/Escort environment for MOMARL."""
2+
23
from momaland.envs.crazyrl.escort.escort import env, parallel_env, raw_env
34

45

momaland/envs/crazyrl/gl_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Graphical representation of the UAV in 3D space. the reference is based on the Crazyflie position reference: https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/functional-areas/lighthouse/terminology_definitions/ ."""
2+
23
import numpy as np
34
from OpenGL.GL import (
45
GL_LINES,

momaland/envs/crazyrl/surround/surround.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Surround environment for Crazyflie 2. Each agent is supposed to learn to surround a common target point."""
2+
23
from typing_extensions import override
34

45
import numpy as np

momaland/envs/crazyrl/surround/surround_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""CrazyRL/Surround environment for MOMARL."""
2+
23
from momaland.envs.crazyrl.surround.surround import env, parallel_env, raw_env
34

45

momaland/envs/gem_mining/mogem_mining_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Gem mining environment for multi-objective optimization."""
2+
23
from momaland.envs.gem_mining.gem_mining import env, parallel_env, raw_env
34

45

momaland/envs/ingenious/ingenious.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ def __init__(
185185
"board": Box(
186186
0, len(ALL_COLORS), shape=(2 * self.board_size - 1, 2 * self.board_size - 1), dtype=np.float32
187187
),
188-
"racks": Box(0, self.num_colors, shape=(num_agents, self.init_draw, 2), dtype=np.int32)
189-
if self.fully_obs
190-
else Box(0, self.num_colors, shape=(self.init_draw, 2), dtype=np.int32),
188+
"racks": (
189+
Box(0, self.num_colors, shape=(num_agents, self.init_draw, 2), dtype=np.int32)
190+
if self.fully_obs
191+
else Box(0, self.num_colors, shape=(self.init_draw, 2), dtype=np.int32)
192+
),
191193
"scores": Box(0, self.game.max_score, shape=(num_agents, self.num_colors), dtype=np.int32),
192194
}
193195
),

momaland/envs/ingenious/ingenious_check.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,12 @@ def check_two_team():
343343
ig_env.step(action)
344344
observation, reward, termination, truncation, _ = ig_env.last()
345345
print("Observations: ", observation["observation"])
346-
print("Rewards: ", reward, "_accumulate_reward(from gymnasium code)", ig_env._cumulative_rewards)
346+
print(
347+
"Rewards: ",
348+
reward,
349+
"_accumulate_reward(from gymnasium code)",
350+
ig_env._cumulative_rewards,
351+
)
347352
print("Truncation: ", truncation)
348353
print("Termination: ", termination)
349354
done = truncation or termination
@@ -372,7 +377,12 @@ def check_collaborative():
372377
ig_env.step(action)
373378
observation, reward, termination, truncation, _ = ig_env.last()
374379
print("Observations: ", observation["observation"])
375-
print("Rewards: ", reward, "_accumulate_reward(from gymnasium code)", ig_env._cumulative_rewards)
380+
print(
381+
"Rewards: ",
382+
reward,
383+
"_accumulate_reward(from gymnasium code)",
384+
ig_env._cumulative_rewards,
385+
)
376386
print("Truncation: ", truncation)
377387
print("Termination: ", termination)
378388
done = truncation or termination
@@ -441,5 +451,5 @@ def check_parameter_range():
441451
# check collaborative mode through simulation, it could be found that every players always share the same score in score board.
442452
check_collaborative()
443453

444-
# check parameter range by ramdom choose.
454+
# check parameter range by random choice.
445455
check_parameter_range()

momaland/envs/ingenious/moingenious_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Multi-objective Ingenious Game."""
2+
23
from momaland.envs.ingenious.ingenious import env, raw_env
34

45

momaland/envs/item_gathering/moitem_gathering_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Item Gathering environment for multi-objective optimization."""
2+
23
from momaland.envs.item_gathering.item_gathering import env, parallel_env, raw_env
34

45

momaland/envs/multiwalker_stability/momultiwalker_stability_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Multiwalker-Stability domain environment for MOMARL."""
2+
23
from momaland.envs.multiwalker_stability.momultiwalker_stability import (
34
env,
45
parallel_env,

momaland/envs/route_choice/moroute_choice_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Route choice environment for multi-objective optimization."""
2+
23
from momaland.envs.route_choice.route_choice import env, parallel_env, raw_env
34

45

momaland/envs/route_choice/networks/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* "od": a list of possible origin-destination (OD) pairs in the network
1010
* "routes": a dictionary which contains routes for OD-pairs
1111
"""
12+
1213
import json
1314
import os
1415

momaland/envs/samegame/mosame_game_v0.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Connect 4 environment with multiple objectives."""
2+
23
from momaland.envs.samegame.same_game import env, raw_env
34

45

momaland/learning/iql/pf_bpd.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- exp1: 50 agents, 5 sections, 3 capacity, type distribution [35, 15]
77
- exp2: 100 agents, 5 sections, 5 capacity, type distribution [70, 30]
88
"""
9+
910
import argparse
1011
from itertools import product
1112

momaland/learning/iql/train_iql_bpd.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Train IQL on the Beach Problem Domain, under linear scalarization, and save the results to a csv file."""
2+
23
import argparse
34
import random
45
import time

momaland/learning/iql/train_iql_route_choice.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Train IQL on the route choice problem domain, under linear scalarization, and save the results to a csv file."""
2+
23
import argparse
34
import os
45
import random

momaland/test/wrapper_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Testing file for the wrappers."""
2+
23
import numpy as np
34

45
import momaland.utils.aec_wrappers as AECWrappers

momaland/utils/aec_wrappers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Various wrappers for AEC MO environments."""
2+
23
from typing import Optional
34

45
import numpy as np

momaland/utils/env.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Overrides PZ types to enforce multi objective rewards."""
2+
23
import warnings
34
from typing import Dict
45
from typing_extensions import override

momaland/utils/parallel_wrappers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Various wrappers for Parallel MO environments."""
2+
23
from collections import namedtuple
34
from typing import Optional
45

py.typed

Whitespace-only changes.

pyproject.toml

+6-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ learning = [
5959
"tqdm >=4.66.1",
6060
"pandas >=2.0.3",
6161
"matplotlib >=3.7.4",
62-
"morl_baselines[all]"
62+
"morl_baselines[all]",
63+
"pycddlib==2.1.6",
6364
]
6465
all = [
6566
# All dependencies above except accept-rom-license
@@ -76,7 +77,8 @@ all = [
7677
"tqdm >=4.66.1",
7778
"pandas >=2.0.3",
7879
"matplotlib >=3.7.4",
79-
"morl_baselines[all]"
80+
"morl_baselines[all]",
81+
"pycddlib==2.1.6",
8082
]
8183
testing = ["pytest ==7.1.3"]
8284

@@ -93,15 +95,15 @@ include-package-data = true
9395
include = ["momaland", "momaland.*"]
9496

9597
[tool.setuptools.package-data]
96-
mo_gymnasium = [
98+
momaland = [
9799
"**/*.json",
98100
"**/assets/*",
101+
"py.typed",
99102
]
100103

101104
# Linters and Test tools #######################################################
102105

103106
[tool.black]
104-
safe = true
105107
line-length = 127
106108
target-version = ['py38', 'py39', 'py310', 'py311']
107109
include = '\.pyi?$'

0 commit comments

Comments
 (0)