1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 pdm-backend,
8 loguru,
9 platformdirs,
10 requests,
11 setuptools,
12 toml,
13 websocket-client,
14 asciimatics,
15 pyperclip,
16 aria2,
17 fastapi,
18 psutil,
19 pytest-xdist,
20 pytestCheckHook,
21 responses,
22 uvicorn,
23
24 withTui ? true,
25}:
26
27buildPythonPackage rec {
28 pname = "aria2p";
29 version = "0.12.1";
30 pyproject = true;
31
32 disabled = pythonOlder "3.6";
33
34 src = fetchFromGitHub {
35 owner = "pawamoy";
36 repo = "aria2p";
37 tag = version;
38 hash = "sha256-JEXTCDfFjxI1hooiEQq0KIGGoS2F7fyzOM0GMl+Jr7w=";
39 };
40
41 build-system = [ pdm-backend ];
42
43 dependencies = [
44 loguru
45 platformdirs
46 requests
47 setuptools # for pkg_resources
48 toml
49 websocket-client
50 ]
51 ++ lib.optionals withTui optional-dependencies.tui;
52
53 optional-dependencies = {
54 tui = [
55 asciimatics
56 pyperclip
57 ];
58 };
59
60 preCheck = ''
61 export HOME=$TMPDIR
62 '';
63
64 nativeCheckInputs = [
65 aria2
66 fastapi
67 pytest-xdist
68 pytestCheckHook
69 responses
70 psutil
71 uvicorn
72 ]
73 ++ optional-dependencies.tui;
74
75 disabledTests = [
76 # require a running display server
77 "test_add_downloads_torrents_and_metalinks"
78 "test_add_downloads_uris"
79 # require a running aria2 server
80 "test_cli_autoclear_commands"
81 "test_get_files_method"
82 "test_pause_subcommand"
83 "test_resume_method"
84 ];
85
86 pythonImportsCheck = [ "aria2p" ];
87
88 meta = {
89 homepage = "https://github.com/pawamoy/aria2p";
90 changelog = "https://github.com/pawamoy/aria2p/blob/${src.tag}/CHANGELOG.md";
91 description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC";
92 mainProgram = "aria2p";
93 license = lib.licenses.isc;
94 maintainers = with lib.maintainers; [ koral ];
95 badPlatforms = [
96 lib.systems.inspect.patterns.isDarwin
97 ];
98 };
99}