1{ lib
2, aiohttp
3, aresponses
4, buildPythonPackage
5, fetchFromGitHub
6, poetry-core
7, pytest-asyncio
8, pytest-freezer
9, pytestCheckHook
10, pythonOlder
11, yarl
12}:
13
14buildPythonPackage rec {
15 pname = "easyenergy";
16 version = "1.0.0";
17 pyproject = true;
18
19 disabled = pythonOlder "3.11";
20
21 src = fetchFromGitHub {
22 owner = "klaasnicolaas";
23 repo = "python-easyenergy";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-HdCrbEk1b+FZzDoMoLcNaPFEHQfDoQsePKmESM9Qhds=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace '"0.0.0"' '"${version}"' \
31 --replace 'addopts = "--cov"' ""
32 '';
33
34 nativeBuildInputs = [
35 poetry-core
36 ];
37
38 propagatedBuildInputs = [
39 aiohttp
40 yarl
41 ];
42
43 nativeCheckInputs = [
44 aresponses
45 pytest-asyncio
46 pytest-freezer
47 pytestCheckHook
48 ];
49
50 pythonImportsCheck = [
51 "easyenergy"
52 ];
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/v${version}";
73 license = with licenses; [ mit ];
74 maintainers = with maintainers; [ fab ];
75 };
76}