1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, aiohttp
5, async-timeout
6, orjson
7, pythonOlder
8, requests
9, websocket-client
10, websockets
11}:
12
13buildPythonPackage rec {
14 pname = "sense-energy";
15 version = "0.11.2";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "scottbonline";
22 repo = "sense";
23 rev = "refs/tags/${version}";
24 hash = "sha256-i6XI6hiQTOGHB4KcDgz/MlYAhdEKaElLfNMq2R0fgu8=";
25 };
26
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace "{{VERSION_PLACEHOLDER}}" "${version}"
30 '';
31
32 propagatedBuildInputs = [
33 aiohttp
34 async-timeout
35 orjson
36 requests
37 websocket-client
38 websockets
39 ];
40
41 # no tests implemented
42 doCheck = false;
43
44 pythonImportsCheck = [
45 "sense_energy"
46 ];
47
48 meta = with lib; {
49 description = "API for the Sense Energy Monitor";
50 homepage = "https://github.com/scottbonline/sense";
51 license = licenses.mit;
52 maintainers = with maintainers; [ dotlambda ];
53 };
54}