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 = "2.1.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-mGLg6Kgur2LAcujFzO/rkSPAC2t3wR5CO2AeOO0+bFI="; 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 ] ++ lib.flatten (lib.attrValues optional-dependencies); 75 76 optional-dependencies = { 77 login = [ 78 attrs 79 httpx 80 python-dateutil 81 tomli 82 tomli-w 83 ]; 84 connect = [ 85 attrs 86 cryptography 87 httpx 88 pynacl 89 python-dateutil 90 tomli 91 tomli-w 92 ]; 93 }; 94 95 nativeCheckInputs = [ 96 pytest-asyncio 97 pytest-httpx 98 pytest-mock 99 pytestCheckHook 100 ] ++ lib.flatten (lib.attrValues optional-dependencies); 101 102 pythonImportsCheck = [ "beanhub_cli" ]; 103 104 meta = { 105 description = "Command line tools for BeanHub or Beancount users"; 106 mainProgram = "bh"; 107 homepage = "https://github.com/LaunchPlatform/beanhub-cli/"; 108 changelog = "https://github.com/LaunchPlatform/beanhub-cli/releases/tag/${src.tag}"; 109 license = with lib.licenses; [ mit ]; 110 maintainers = with lib.maintainers; [ fangpen ]; 111 }; 112}