1{
2 lib,
3 awesomeversion,
4 buildPythonPackage,
5 envoy-utils,
6 fetchFromGitHub,
7 httpx,
8 lxml,
9 orjson,
10 poetry-core,
11 pyjwt,
12 pytest-asyncio,
13 pytestCheckHook,
14 pythonOlder,
15 respx,
16 syrupy,
17 tenacity,
18}:
19
20buildPythonPackage rec {
21 pname = "pyenphase";
22 version = "1.20.3";
23 pyproject = true;
24
25 disabled = pythonOlder "3.11";
26
27 src = fetchFromGitHub {
28 owner = "pyenphase";
29 repo = "pyenphase";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-4lMsyzw56gFimUs52mEzy5eKYF9s2ClNi3yfdIBbccY=";
32 };
33
34 postPatch = ''
35 substituteInPlace pyproject.toml \
36 --replace-fail " --cov=pyenphase --cov-report=term-missing:skip-covered" ""
37 '';
38
39 build-system = [ poetry-core ];
40
41 dependencies = [
42 awesomeversion
43 envoy-utils
44 httpx
45 lxml
46 orjson
47 pyjwt
48 tenacity
49 ];
50
51 nativeCheckInputs = [
52 pytest-asyncio
53 pytestCheckHook
54 respx
55 syrupy
56 ];
57
58 disabledTests = [
59 # https://github.com/pyenphase/pyenphase/issues/97
60 "test_with_7_x_firmware"
61 ];
62
63 pythonImportsCheck = [ "pyenphase" ];
64
65 meta = with lib; {
66 description = "Library to control enphase envoy";
67 homepage = "https://github.com/pyenphase/pyenphase";
68 changelog = "https://github.com/pyenphase/pyenphase/blob/v${version}/CHANGELOG.md";
69 license = licenses.mit;
70 maintainers = with maintainers; [ fab ];
71 };
72}