1{ lib
2, aiohttp
3, async-timeout
4, buildPythonPackage
5, fetchFromGitHub
6, fetchpatch
7, poetry-core
8, pytest-asyncio
9, pytest-timeout
10, pytestCheckHook
11, pythonOlder
12, pytz
13}:
14
15buildPythonPackage rec {
16 pname = "aiopvpc";
17 version = "2.0.2";
18 disabled = pythonOlder "3.7";
19 format = "pyproject";
20
21 src = fetchFromGitHub {
22 owner = "azogue";
23 repo = pname;
24 rev = "v${version}";
25 sha256 = "1ajs4kbdlfn4h7f3d6lwkp4yl1rl7zyvj997nhsz93jjwxbajkpv";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 propagatedBuildInputs = [
33 aiohttp
34 pytz
35 async-timeout
36 ];
37
38 checkInputs = [
39 pytest-asyncio
40 pytest-timeout
41 pytestCheckHook
42 ];
43
44 patches = [
45 # Switch to poetry-core, https://github.com/azogue/aiopvpc/pull/10
46 (fetchpatch {
47 name = "use-peotry-core.patch";
48 url = "https://github.com/azogue/aiopvpc/commit/4bc2740ffd485a60acf579b4f3eb5ee6a353245c.patch";
49 sha256 = "0ynj7pqq3akdvdrvqcwnnslay3mn1q92qhk8fg95ppflzscixli6";
50 })
51 ];
52
53 postPatch = ''
54 substituteInPlace pytest.ini --replace \
55 " --cov --cov-report term --cov-report html" ""
56 '';
57
58 pythonImportsCheck = [ "aiopvpc" ];
59
60 meta = with lib; {
61 description = "Python module to download Spanish electricity hourly prices (PVPC)";
62 homepage = "https://github.com/azogue/aiopvpc";
63 license = with licenses; [ mit ];
64 maintainers = with maintainers; [ fab ];
65 };
66}