1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6 pytestCheckHook,
7
8 # dependencies
9 beancount-black,
10 beancount-parser,
11 beanhub-forms,
12 beanhub-import,
13 click,
14 fastapi,
15 jinja2,
16 poetry-core,
17 pydantic-settings,
18 pydantic,
19 pyyaml,
20 rich,
21 starlette-wtf,
22 uvicorn,
23
24 # optional-dependencies
25 attrs,
26 cryptography,
27 httpx,
28 pynacl,
29 python-dateutil,
30 tomli-w,
31 tomli,
32
33 # tests
34 pytest,
35 pytest-asyncio,
36 pytest-httpx,
37 pytest-mock,
38}:
39
40buildPythonPackage rec {
41 pname = "beanhub-cli";
42 version = "3.0.1";
43 pyproject = true;
44
45 disabled = pythonOlder "3.10";
46
47 src = fetchFromGitHub {
48 owner = "LaunchPlatform";
49 repo = "beanhub-cli";
50 tag = version;
51 hash = "sha256-hreVGsptCGW6L3rj6Ec8+lefZWpQ4tZtUEJI+NxTO7w=";
52 };
53
54 pythonRelaxDeps = [
55 "rich"
56 ];
57
58 build-system = [ poetry-core ];
59
60 dependencies = [
61 beancount-black
62 beancount-parser
63 beanhub-forms
64 beanhub-import
65 click
66 fastapi
67 jinja2
68 pydantic
69 pydantic-settings
70 pyyaml
71 rich
72 starlette-wtf
73 uvicorn
74 ]
75 ++ lib.flatten (lib.attrValues optional-dependencies);
76
77 optional-dependencies = {
78 login = [
79 attrs
80 httpx
81 python-dateutil
82 tomli
83 tomli-w
84 ];
85 connect = [
86 attrs
87 cryptography
88 httpx
89 pynacl
90 python-dateutil
91 tomli
92 tomli-w
93 ];
94 };
95
96 nativeCheckInputs = [
97 pytest-asyncio
98 pytest-httpx
99 pytest-mock
100 pytestCheckHook
101 ]
102 ++ lib.flatten (lib.attrValues optional-dependencies);
103
104 pythonImportsCheck = [ "beanhub_cli" ];
105
106 meta = {
107 description = "Command line tools for BeanHub or Beancount users";
108 mainProgram = "bh";
109 homepage = "https://github.com/LaunchPlatform/beanhub-cli/";
110 changelog = "https://github.com/LaunchPlatform/beanhub-cli/releases/tag/${src.tag}";
111 license = with lib.licenses; [ mit ];
112 maintainers = with lib.maintainers; [ fangpen ];
113 };
114}