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