summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/meshtastic/default.nix
blob: a33d28e433d12d239b66cfcbbbef690632a943d5 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
  lib,
  argcomplete,
  bleak,
  buildPythonPackage,
  dash-bootstrap-components,
  dash,
  dotmap,
  fetchFromGitHub,
  hypothesis,
  packaging,
  pandas-stubs,
  pandas,
  parse,
  platformdirs,
  poetry-core,
  ppk2-api,
  print-color,
  protobuf,
  pyarrow,
  pypubsub,
  pyqrcode,
  pyserial,
  pytap2,
  pytestCheckHook,
  pythonOlder,
  pyyaml,
  requests,
  riden,
  setuptools,
  tabulate,
  wcwidth,
}:

buildPythonPackage rec {
  pname = "meshtastic";
  version = "2.6.0";
  pyproject = true;

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "meshtastic";
    repo = "python";
    tag = version;
    hash = "sha256-JPQa5l+xIHjA6STLVg887drYG7wXKvGBArV6cOzYKvA=";
  };

  pythonRelaxDeps = [
    "bleak"
    "protobuf"
  ];

  build-system = [ poetry-core ];

  dependencies = [
    bleak
    packaging
    protobuf
    pypubsub
    pyserial
    pyyaml
    requests
    setuptools
    tabulate
  ];

  optional-dependencies = {
    analysis = [
      dash
      dash-bootstrap-components
      pandas
      pandas-stubs
    ];
    cli = [
      argcomplete
      dotmap
      print-color
      pyqrcode
      wcwidth
    ];
    powermon = [
      parse
      platformdirs
      ppk2-api
      pyarrow
      riden
    ];
    tunnel = [ pytap2 ];
  };

  nativeCheckInputs = [
    hypothesis
    pytestCheckHook
  ] ++ lib.flatten (builtins.attrValues optional-dependencies);

  preCheck = ''
    export PATH="$PATH:$out/bin";
  '';

  pythonImportsCheck = [ "meshtastic" ];

  disabledTestPaths = [
    # Circular import with dash-bootstrap-components
    "meshtastic/tests/test_analysis.py"
  ];

  disabledTests = [
    # TypeError
    "test_main_info_with_seriallog_output_txt"
    "test_main_info_with_seriallog_stdout"
    "test_main_info_with_tcp_interfa"
    "test_main_info"
    "test_main_no_proto"
    "test_main_support"
    "test_MeshInterface"
    "test_message_to_json_shows_all"
    "test_node"
    "test_SerialInterface_single_port"
    "test_support_info"
    "test_TCPInterface"
  ];

  meta = with lib; {
    description = "Python API for talking to Meshtastic devices";
    homepage = "https://github.com/meshtastic/python";
    changelog = "https://github.com/meshtastic/python/releases/tag/${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ fab ];
  };
}