1{
2 lib,
3 stdenv,
4 aocd-example-parser,
5 beautifulsoup4,
6 buildPythonPackage,
7 fetchFromGitHub,
8 numpy,
9 pebble,
10 pook,
11 pytest-freezegun,
12 pytest-mock,
13 pytest-raisin,
14 pytest-socket,
15 pytestCheckHook,
16 python-dateutil,
17 pythonOlder,
18 requests,
19 requests-mock,
20 rich,
21 setuptools,
22 termcolor,
23 tzlocal,
24}:
25
26buildPythonPackage rec {
27 pname = "aocd";
28 version = "2.0.1";
29 pyproject = true;
30
31 disabled = pythonOlder "3.9";
32
33 src = fetchFromGitHub {
34 owner = "wimglenn";
35 repo = "advent-of-code-data";
36 rev = "refs/tags/v${version}";
37 hash = "sha256-YZvcR97uHceloqwoP+azaBmj3GLusYNbItLIaeJ3QD0=";
38 };
39
40 nativeBuildInputs = [ setuptools ];
41
42 propagatedBuildInputs = [
43 aocd-example-parser
44 beautifulsoup4
45 pebble
46 python-dateutil
47 requests
48 rich # for example parser aoce. must either be here or checkInputs
49 termcolor
50 tzlocal
51 ];
52
53 nativeCheckInputs = [
54 numpy
55 pook
56 pytest-freezegun
57 pytest-mock
58 pytest-raisin
59 pytest-socket
60 pytestCheckHook
61 requests-mock
62 ];
63
64 # Too many failing tests
65 preCheck = "rm pytest.ini";
66
67 disabledTests = [
68 "test_results"
69 "test_results_xmas"
70 "test_run_error"
71 "test_run_and_autosubmit"
72 "test_run_and_no_autosubmit"
73 "test_load_input_from_file"
74 "test_examples_cache" # IndexError: list index out of range
75 "test_example_partial" # ValueError: not enough values to unpack (expected 1, got 0)
76 "test_run_against_examples" # AssertionError: assert '2022/25 - The Puzzle Title' in ''
77 "test_aocd_no_examples" # SystemExit: 2
78 "test_aocd_examples" # SystemExit: 2
79 "test_aoce" # SystemExit: 1
80
81 # TypeError: sequence item 0: expected str instance, bool found
82 # Likely because they use `pook.get` to get a webpage
83 "test_submit_prevents_bad_guesses_too_high"
84 "test_submit_prevents_bad_guesses_too_low"
85 "test_submit_prevents_bad_guesses_known_incorrect"
86 "test_submit_correct_answer"
87 "test_correct_submit_reopens_browser_on_answer_page"
88 "test_server_error"
89 "test_submit_when_already_solved"
90 "test_submitted_too_recently_autoretry"
91 "test_submitted_too_recently_autoretry_quiet"
92 "test_submit_when_submitted_too_recently_no_autoretry"
93 "test_submit_wrong_answer "
94 "test_correct_submit_records_good_answer"
95 "test_submits_for_partb_when_already_submitted_parta"
96 "test_submit_when_parta_solved_but_answer_unsaved"
97 "test_submit_saves_both_answers_if_possible"
98 "test_submit_puts_level1_by_default"
99 "test_cannot_submit_same_bad_answer_twice"
100 "test_submit_float_warns"
101 ];
102
103 pythonImportsCheck = [ "aocd" ];
104
105 meta = with lib; {
106 description = "Get your Advent of Code data with a single import statement";
107 homepage = "https://github.com/wimglenn/advent-of-code-data";
108 changelog = "https://github.com/wimglenn/advent-of-code-data/releases/tag/v${version}";
109 license = licenses.mit;
110 maintainers = with maintainers; [ aadibajpai ];
111 platforms = platforms.unix;
112 };
113}