1{ 2 lib, 3 fetchFromGitHub, 4 buildPythonPackage, 5 pythonOlder, 6 hatchling, 7 8 # dependencies 9 beancount-black, 10 beancount-parser, 11 beanhub-forms, 12 beanhub-import, 13 beanhub-inbox, 14 click, 15 fastapi, 16 jinja2, 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-asyncio, 35 pytest-factoryboy, 36 pytest-httpx, 37 pytest-mock, 38 pytestCheckHook, 39}: 40 41buildPythonPackage rec { 42 pname = "beanhub-cli"; 43 version = "3.0.1"; 44 pyproject = true; 45 46 disabled = pythonOlder "3.10"; 47 48 src = fetchFromGitHub { 49 owner = "LaunchPlatform"; 50 repo = "beanhub-cli"; 51 tag = version; 52 hash = "sha256-hreVGsptCGW6L3rj6Ec8+lefZWpQ4tZtUEJI+NxTO7w="; 53 }; 54 55 pythonRelaxDeps = [ "rich" ]; 56 57 build-system = [ hatchling ]; 58 59 dependencies = [ 60 beancount-black 61 beancount-parser 62 beanhub-forms 63 beanhub-import 64 beanhub-inbox 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-factoryboy 99 pytest-httpx 100 pytest-mock 101 pytestCheckHook 102 ] 103 ++ lib.flatten (lib.attrValues optional-dependencies); 104 105 pythonImportsCheck = [ "beanhub_cli" ]; 106 107 meta = { 108 description = "Command line tools for BeanHub or Beancount users"; 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 mainProgram = "bh"; 114 }; 115}