1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 numpy,
7 cloudpickle,
8 gym-notices,
9 jax-jumpy,
10 typing-extensions,
11 farama-notifications,
12 importlib-metadata,
13 pythonOlder,
14 ffmpeg,
15 jax,
16 jaxlib,
17 matplotlib,
18 moviepy,
19 opencv4,
20 pybox2d,
21 pygame,
22 pytestCheckHook,
23 scipy,
24 stdenv,
25}:
26
27buildPythonPackage rec {
28 pname = "gymnasium";
29 version = "0.29.1";
30 format = "pyproject";
31
32 src = fetchFromGitHub {
33 owner = "Farama-Foundation";
34 repo = "gymnasium";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-L7fn9FaJzXwQhjDKwI9hlFpbPuQdwynU+Xjd8bbjxiw=";
37 };
38
39 nativeBuildInputs = [ setuptools ];
40
41 propagatedBuildInputs = [
42 cloudpickle
43 farama-notifications
44 gym-notices
45 jax-jumpy
46 numpy
47 typing-extensions
48 ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
49
50 pythonImportsCheck = [ "gymnasium" ];
51
52 nativeCheckInputs = [
53 ffmpeg
54 jax
55 jaxlib
56 matplotlib
57 moviepy
58 opencv4
59 pybox2d
60 pygame
61 pytestCheckHook
62 scipy
63 ];
64
65 # if `doCheck = true` on Darwin, `jaxlib` is evaluated, which is both
66 # marked as broken and throws an error during evaluation if the package is evaluated anyway.
67 # disabling checks on Darwin avoids this and allows the package to be built.
68 # if jaxlib is ever fixed on Darwin, remove this.
69 doCheck = !stdenv.isDarwin;
70
71 disabledTestPaths = [
72 # mujoco is required for those tests but the mujoco python bindings are not packaged in nixpkgs.
73 "tests/envs/mujoco/test_mujoco_custom_env.py"
74
75 # Those tests need to write on the filesystem which cause them to fail.
76 "tests/experimental/wrappers/test_record_video.py"
77 "tests/utils/test_save_video.py"
78 "tests/wrappers/test_record_video.py"
79 "tests/wrappers/test_video_recorder.py"
80 ];
81
82 meta = with lib; {
83 description = "A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)";
84 homepage = "https://github.com/Farama-Foundation/Gymnasium";
85 license = licenses.mit;
86 maintainers = with maintainers; [ GaetanLepage ];
87 };
88}