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