1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 setuptools,
7 wheel,
8 gymnasium,
9 numpy,
10 chess,
11 pillow,
12 pybox2d,
13 pygame,
14 pymunk,
15 rlcard,
16 scipy,
17 pre-commit,
18 pynput,
19 pytest,
20 pytest-cov,
21 pytest-markdown-docs,
22 pytest-xdist,
23 pytestCheckHook,
24 stdenv,
25}:
26
27buildPythonPackage rec {
28 pname = "pettingzoo";
29 version = "1.24.3";
30 pyproject = true;
31
32 disabled = pythonOlder "3.8";
33
34 src = fetchFromGitHub {
35 owner = "Farama-Foundation";
36 repo = "PettingZoo";
37 rev = "refs/tags/${version}";
38 hash = "sha256-TVM4MrA4W6AIWEdBIecI85ahJAAc21f27OzCxSpOoZU=";
39 };
40
41 build-system = [
42 setuptools
43 wheel
44 ];
45
46 dependencies = [
47 gymnasium
48 numpy
49 ];
50
51 passthru.optional-dependencies = {
52 all = [
53 chess
54 # multi-agent-ale-py
55 pillow
56 pybox2d
57 pygame
58 pymunk
59 rlcard
60 scipy
61 # shimmy
62 ];
63 atari = [
64 # multi-agent-ale-py
65 pygame
66 ];
67 butterfly = [
68 pygame
69 pymunk
70 ];
71 classic = [
72 chess
73 pygame
74 rlcard
75 # shimmy
76 ];
77 mpe = [ pygame ];
78 other = [ pillow ];
79 sisl = [
80 pybox2d
81 pygame
82 pymunk
83 scipy
84 ];
85 testing = [
86 # autorom
87 pre-commit
88 pynput
89 pytest
90 pytest-cov
91 pytest-markdown-docs
92 pytest-xdist
93 ];
94 };
95
96 pythonImportsCheck = [ "pettingzoo" ];
97
98 nativeCheckInputs = [
99 chess
100 pygame
101 pymunk
102 pytest-markdown-docs
103 pytest-xdist
104 pytestCheckHook
105 rlcard
106 ];
107
108 disabledTestPaths = [
109 # Require unpackaged multi_agent_ale_py
110 "test/all_parameter_combs_test.py"
111 "test/pickle_test.py"
112 "test/unwrapped_test.py"
113 ];
114
115 disabledTests =
116 [
117 # ImportError: cannot import name 'pytest_plugins' from 'pettingzoo.classic'
118 "test_chess"
119 ]
120 ++ lib.optionals stdenv.isDarwin [
121 # Crashes on darwin: `Fatal Python error: Aborted`
122 "test_multi_episode_parallel_env_wrapper"
123 ];
124
125 meta = with lib; {
126 description = "An API standard for multi-agent reinforcement learning environments, with popular reference environments and related utilities";
127 homepage = "https://github.com/Farama-Foundation/PettingZoo";
128 changelog = "https://github.com/Farama-Foundation/PettingZoo/releases/tag/${version}";
129 license = licenses.mit;
130 maintainers = with maintainers; [ GaetanLepage ];
131 };
132}