1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 wheel,
7 numpy,
8 pip,
9 termcolor,
10 pytestCheckHook,
11 torch,
12 pythonAtLeast,
13}:
14
15buildPythonPackage rec {
16 pname = "rlcard";
17 version = "1.0.7";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "datamllab";
22 repo = "rlcard";
23 rev = "refs/tags/${version}";
24 hash = "sha256-SWj6DBItQzSM+nioV54a350Li7tbBaVXsQxNAqVgB0k=";
25 };
26
27 build-system = [
28 setuptools
29 wheel
30 ];
31
32 dependencies = [
33 numpy
34 # pip is required at runtime (https://github.com/datamllab/rlcard/blob/1.0.7/rlcard/utils/utils.py#L10)
35 pip
36 termcolor
37 ];
38
39 pythonImportsCheck = [ "rlcard" ];
40
41 nativeCheckInputs = [
42 pytestCheckHook
43 torch
44 ];
45
46 disabledTests = [
47 # AttributeError: module 'numpy' has no attribute 'int'.
48 # https://github.com/datamllab/rlcard/issues/266
49 "test_decode_action"
50 "test_get_legal_actions"
51 "test_get_perfect_information"
52 "test_get_player_id"
53 "test_init_game"
54 "test_is_deterministic"
55 "test_proceed_game"
56 "test_reset_and_extract_state"
57 "test_run"
58 "test_step"
59 "test_step"
60 "test_step_back"
61 "test_step_back"
62
63 # ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 3 dimensions. The detected shape was (1, 1, 5) + inhomogeneous part.
64 "test_reorganize"
65 ];
66
67 meta = with lib; {
68 description = "Reinforcement Learning / AI Bots in Card (Poker) Games - Blackjack, Leduc, Texas, DouDizhu, Mahjong, UNO";
69 homepage = "https://github.com/datamllab/rlcard";
70 changelog = "https://github.com/datamllab/rlcard/releases/tag/${version}";
71 license = licenses.mit;
72 maintainers = with maintainers; [ GaetanLepage ];
73 # Relies on deprecated distutils
74 broken = pythonAtLeast "3.12";
75 };
76}