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.6.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-pco8io8MzbK7Jv9rkzSK0A9UDLSyvfoZarFFjBLBNoM=";
47 };
48
49 pythonRelaxDeps = [
50 "bleak"
51 "protobuf"
52 ];
53
54 build-system = [ poetry-core ];
55
56 dependencies = [
57 bleak
58 packaging
59 protobuf
60 pypubsub
61 pyserial
62 pyyaml
63 requests
64 setuptools
65 tabulate
66 ];
67
68 optional-dependencies = {
69 analysis = [
70 dash
71 dash-bootstrap-components
72 pandas
73 pandas-stubs
74 ];
75 cli = [
76 argcomplete
77 dotmap
78 print-color
79 pyqrcode
80 wcwidth
81 ];
82 powermon = [
83 parse
84 platformdirs
85 ppk2-api
86 pyarrow
87 riden
88 ];
89 tunnel = [ pytap2 ];
90 };
91
92 nativeCheckInputs = [
93 hypothesis
94 pytestCheckHook
95 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
96
97 preCheck = ''
98 export PATH="$PATH:$out/bin";
99 '';
100
101 pythonImportsCheck = [ "meshtastic" ];
102
103 disabledTestPaths = [
104 # Circular import with dash-bootstrap-components
105 "meshtastic/tests/test_analysis.py"
106 ];
107
108 disabledTests = [
109 # TypeError
110 "test_main_info_with_seriallog_output_txt"
111 "test_main_info_with_seriallog_stdout"
112 "test_main_info_with_tcp_interfa"
113 "test_main_info"
114 "test_main_no_proto"
115 "test_main_support"
116 "test_MeshInterface"
117 "test_message_to_json_shows_all"
118 "test_node"
119 "test_SerialInterface_single_port"
120 "test_support_info"
121 "test_TCPInterface"
122 ];
123
124 meta = with lib; {
125 description = "Python API for talking to Meshtastic devices";
126 homepage = "https://github.com/meshtastic/python";
127 changelog = "https://github.com/meshtastic/python/releases/tag/${version}";
128 license = licenses.asl20;
129 maintainers = with maintainers; [ fab ];
130 };
131}