1{
2 lib,
3 beancount,
4 click,
5 buildPythonPackage,
6 fetchFromGitHub,
7 fetchpatch2,
8 python-dateutil,
9 pytestCheckHook,
10 setuptools,
11 tatsu-lts,
12}:
13buildPythonPackage rec {
14 pname = "beanquery";
15 version = "0.2.0";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "beancount";
20 repo = "beanquery";
21 tag = "v${version}";
22 hash = "sha256-O7+WCF7s50G14oNTvJAOTvgSoNR9fWcn/m1jv7RHmK8=";
23 };
24
25 patches = [
26 (fetchpatch2 {
27 name = "beancount-workaround.patch";
28 url = "https://github.com/beancount/beanquery/commit/aa0776285a25baeedf151e9f582bef0314f76004.patch?full_index=1";
29 hash = "sha256-hWL1CDsBSbMqufEQrtEncmyUr5L5VJI+i4xQtnAvQd8=";
30 })
31 ];
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 beancount
37 click
38 python-dateutil
39 tatsu-lts
40 ];
41
42 nativeCheckInputs = [ pytestCheckHook ];
43
44 pythonImportsCheck = [
45 "beanquery"
46 ];
47
48 meta = with lib; {
49 homepage = "https://github.com/beancount/beanquery";
50 description = "Beancount Query Language";
51 longDescription = ''
52 A customizable light-weight SQL query tool that works on tabular data,
53 including Beancount.
54 '';
55 license = licenses.gpl2Only;
56 maintainers = with maintainers; [ alapshin ];
57 mainProgram = "bean-query";
58 };
59}