summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/beanhub-cli/default.nix
blob: 188182e5094bb8737f8d47e2de9e8d5bc99b1487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  hatchling,

  # dependencies
  beancount-black,
  beancount-parser,
  beanhub-forms,
  beanhub-import,
  beanhub-inbox,
  click,
  fastapi,
  jinja2,
  pydantic-settings,
  pydantic,
  pyyaml,
  rich,
  starlette-wtf,
  uvicorn,

  # optional-dependencies
  attrs,
  cryptography,
  httpx,
  pynacl,
  python-dateutil,
  tomli-w,
  tomli,

  # tests
  pytest-asyncio,
  pytest-factoryboy,
  pytest-httpx,
  pytest-mock,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "beanhub-cli";
  version = "3.0.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "LaunchPlatform";
    repo = "beanhub-cli";
    tag = version;
    hash = "sha256-hreVGsptCGW6L3rj6Ec8+lefZWpQ4tZtUEJI+NxTO7w=";
  };

  pythonRelaxDeps = [ "rich" ];

  build-system = [ hatchling ];

  dependencies = [
    beancount-black
    beancount-parser
    beanhub-forms
    beanhub-import
    beanhub-inbox
    click
    fastapi
    jinja2
    pydantic
    pydantic-settings
    pyyaml
    rich
    starlette-wtf
    uvicorn
  ]
  ++ lib.concatAttrValues optional-dependencies;

  optional-dependencies = {
    login = [
      attrs
      httpx
      python-dateutil
      tomli
      tomli-w
    ];
    connect = [
      attrs
      cryptography
      httpx
      pynacl
      python-dateutil
      tomli
      tomli-w
    ];
  };

  nativeCheckInputs = [
    pytest-asyncio
    pytest-factoryboy
    pytest-httpx
    pytest-mock
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "beanhub_cli" ];

  meta = {
    description = "Command line tools for BeanHub or Beancount users";
    homepage = "https://github.com/LaunchPlatform/beanhub-cli/";
    changelog = "https://github.com/LaunchPlatform/beanhub-cli/releases/tag/${src.tag}";
    license = with lib.licenses; [ mit ];
    maintainers = with lib.maintainers; [ fangpen ];
    mainProgram = "bh";
  };
}