1{
2 lib,
3 stdenv,
4 antlr4-python3-runtime,
5 asciimatics,
6 buildPythonPackage,
7 click,
8 dacite,
9 decorator,
10 fetchFromGitHub,
11 first,
12 jsonpath-ng,
13 loguru,
14 overrides,
15 pillow,
16 ply,
17 pyfiglet,
18 pyperclip,
19 pytestCheckHook,
20 pythonOlder,
21 antlr4,
22 pyyaml,
23 setuptools,
24 urwid,
25 parameterized,
26 wcwidth,
27 yamale,
28}:
29
30buildPythonPackage rec {
31 pname = "python-fx";
32 version = "0.3.2";
33 pyproject = true;
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchFromGitHub {
38 owner = "cielong";
39 repo = "pyfx";
40 tag = "v${version}";
41 hash = "sha256-Q5ihWnoa7nf4EkrY4SgrwjaNvTva4RdW9GRbnbsPXPc=";
42 };
43
44 postPatch = ''
45 rm src/pyfx/model/common/jsonpath/*.py # upstream checks in generated files, remove to ensure they were regenerated
46 antlr -Dlanguage=Python3 -visitor src/pyfx/model/common/jsonpath/*.g4
47 rm src/pyfx/model/common/jsonpath/*.{g4,interp,tokens} # no need to install
48
49 # https://github.com/cielong/pyfx/pull/148
50 substituteInPlace src/pyfx/view/common/frame.py \
51 --replace-fail "self.__super.__init__()" "super().__init__()"
52 '';
53
54 pythonRelaxDeps = true;
55
56 build-system = [ setuptools ];
57
58 nativeBuildInputs = [ antlr4 ];
59
60 dependencies = [
61 antlr4-python3-runtime
62 asciimatics
63 click
64 dacite
65 decorator
66 first
67 jsonpath-ng
68 loguru
69 overrides
70 pillow
71 ply
72 pyfiglet
73 pyperclip
74 pyyaml
75 urwid
76 wcwidth
77 yamale
78 ];
79
80 nativeCheckInputs = [
81 pytestCheckHook
82 parameterized
83 ];
84
85 # FAILED tests/test_event_loops.py::TwistedEventLoopTest::test_run - AssertionError: 'callback called with future outcome: True' not found in ['...
86 doCheck = !stdenv.hostPlatform.isDarwin;
87
88 pythonImportsCheck = [ "pyfx" ];
89
90 meta = with lib; {
91 description = "Module to view JSON in a TUI";
92 homepage = "https://github.com/cielong/pyfx";
93 changelog = "https://github.com/cielong/pyfx/releases/tag/${src.tag}";
94 license = licenses.mit;
95 maintainers = with maintainers; [ fab ];
96 mainProgram = "pyfx";
97 };
98}