1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 fetchpatch,
6 flit-core,
7 dos2unix,
8 httpx,
9 pytest-asyncio,
10 pytest-cov-stub,
11 pytest-mock,
12 pytestCheckHook,
13 pythonOlder,
14}:
15
16buildPythonPackage rec {
17 pname = "zeversolarlocal";
18 version = "1.1.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-ExZy5k5RE7k+D0lGmuIkGWrWQ+m24K2oqbUEg4BAVuY=";
26 };
27
28 build-system = [
29 flit-core
30 dos2unix
31 ];
32
33 dependencies = [ httpx ];
34
35 nativeCheckInputs = [
36 pytest-asyncio
37 pytest-cov-stub
38 pytest-mock
39 pytestCheckHook
40 ];
41
42 # the patch below won't apply unless we fix the line endings
43 prePatch = ''
44 dos2unix pyproject.toml
45 '';
46
47 patches = [
48 # Raise the flit-core limit
49 # https://github.com/sander76/zeversolarlocal/pull/4
50 (fetchpatch {
51 url = "https://github.com/sander76/zeversolarlocal/commit/bff072ea046de07eced77bc79eb8e90dfef1f53f.patch";
52 hash = "sha256-tzFCwPzhAfwVfN5mLY/DMwRv7zGzx3ScBe+kKzkYcvo=";
53 })
54 ];
55
56 disabledTests = [
57 # Test requires network access
58 "test_httpx_timeout"
59 ];
60
61 pythonImportsCheck = [ "zeversolarlocal" ];
62
63 meta = with lib; {
64 description = "Python module to interact with Zeversolar inverters";
65 homepage = "https://github.com/sander76/zeversolarlocal";
66 license = licenses.mit;
67 maintainers = with maintainers; [ fab ];
68 };
69}