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