1{
2 lib,
3 argcomplete,
4 bleak,
5 buildPythonPackage,
6 dash-bootstrap-components,
7 dash,
8 dotmap,
9 fetchFromGitHub,
10 hypothesis,
11 packaging,
12 pandas-stubs,
13 pandas,
14 parse,
15 platformdirs,
16 poetry-core,
17 ppk2-api,
18 print-color,
19 protobuf,
20 pyarrow,
21 pypubsub,
22 pyqrcode,
23 pyserial,
24 pytap2,
25 pytestCheckHook,
26 pythonOlder,
27 pyyaml,
28 requests,
29 riden,
30 setuptools,
31 tabulate,
32 wcwidth,
33}:
34
35buildPythonPackage rec {
36 pname = "meshtastic";
37 version = "2.7.3";
38 pyproject = true;
39
40 disabled = pythonOlder "3.9";
41
42 src = fetchFromGitHub {
43 owner = "meshtastic";
44 repo = "python";
45 tag = version;
46 hash = "sha256-9p9tDc74WpH0+8orI69bW2Yj7Cow4v7M3cotIbk/mcw=";
47 };
48
49 pythonRelaxDeps = [
50 "bleak"
51 "packaging"
52 "protobuf"
53 ];
54
55 build-system = [ poetry-core ];
56
57 dependencies = [
58 bleak
59 packaging
60 protobuf
61 pypubsub
62 pyserial
63 pyyaml
64 requests
65 setuptools
66 tabulate
67 ];
68
69 optional-dependencies = {
70 analysis = [
71 dash
72 dash-bootstrap-components
73 pandas
74 pandas-stubs
75 ];
76 cli = [
77 argcomplete
78 dotmap
79 print-color
80 pyqrcode
81 wcwidth
82 ];
83 powermon = [
84 parse
85 platformdirs
86 ppk2-api
87 pyarrow
88 riden
89 ];
90 tunnel = [ pytap2 ];
91 };
92
93 nativeCheckInputs = [
94 hypothesis
95 pytestCheckHook
96 ]
97 ++ lib.flatten (builtins.attrValues optional-dependencies);
98
99 preCheck = ''
100 export PATH="$PATH:$out/bin";
101 '';
102
103 pythonImportsCheck = [ "meshtastic" ];
104
105 disabledTestPaths = [
106 # Circular import with dash-bootstrap-components
107 "meshtastic/tests/test_analysis.py"
108 ];
109
110 disabledTests = [
111 # TypeError
112 "test_main_info_with_seriallog_output_txt"
113 "test_main_info_with_seriallog_stdout"
114 "test_main_info_with_tcp_interfa"
115 "test_main_info"
116 "test_main_no_proto"
117 "test_main_support"
118 "test_MeshInterface"
119 "test_message_to_json_shows_all"
120 "test_node"
121 "test_SerialInterface_single_port"
122 "test_support_info"
123 "test_TCPInterface"
124 ];
125
126 meta = with lib; {
127 description = "Python API for talking to Meshtastic devices";
128 homepage = "https://github.com/meshtastic/python";
129 changelog = "https://github.com/meshtastic/python/releases/tag/${version}";
130 license = licenses.asl20;
131 maintainers = with maintainers; [ fab ];
132 };
133}