1{
2 lib,
3 aiohttp,
4 aresponses,
5 buildPythonPackage,
6 fetchFromGitHub,
7 poetry-core,
8 pytest-asyncio,
9 pytest-cov-stub,
10 pytest-freezer,
11 pytestCheckHook,
12 pythonOlder,
13 syrupy,
14 yarl,
15}:
16
17buildPythonPackage rec {
18 pname = "easyenergy";
19 version = "2.2.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.11";
23
24 src = fetchFromGitHub {
25 owner = "klaasnicolaas";
26 repo = "python-easyenergy";
27 tag = "v${version}";
28 hash = "sha256-AFEygSSHr7YJK4Yx4dvBVGR3wBswAeUNrC/7NndzfBg=";
29 };
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace '"0.0.0"' '"${version}"'
34 '';
35
36 nativeBuildInputs = [ poetry-core ];
37
38 propagatedBuildInputs = [
39 aiohttp
40 yarl
41 ];
42
43 nativeCheckInputs = [
44 aresponses
45 pytest-asyncio
46 pytest-cov-stub
47 pytest-freezer
48 pytestCheckHook
49 syrupy
50 ];
51
52 pythonImportsCheck = [ "easyenergy" ];
53
54 disabledTests = [
55 # Tests require network access
56 "test_json_request"
57 "test_internal_session"
58 "test_electricity_model_usage"
59 "test_electricity_model_return"
60 "test_electricity_none_data"
61 "test_no_electricity_data"
62 "test_gas_morning_model"
63 "test_gas_model"
64 "test_gas_none_data"
65 "test_no_gas_data"
66 "test_electricity_midnight"
67 ];
68
69 meta = with lib; {
70 description = "Module for getting energy/gas prices from easyEnergy";
71 homepage = "https://github.com/klaasnicolaas/python-easyenergy";
72 changelog = "https://github.com/klaasnicolaas/python-easyenergy/releases/tag/${src.tag}";
73 license = licenses.mit;
74 maintainers = with maintainers; [ fab ];
75 };
76}