1{ lib
2, aiohttp
3, async-timeout
4, backports-zoneinfo
5, buildPythonPackage
6, fetchFromGitHub
7, poetry-core
8, pytest-asyncio
9, pytest-timeout
10, pytestCheckHook
11, pythonOlder
12, python-dotenv
13}:
14
15buildPythonPackage rec {
16 pname = "aiopvpc";
17 version = "4.2.2";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "azogue";
24 repo = pname;
25 rev = "refs/tags/v${version}";
26 hash = "sha256-k02lNjFjOcMfHa1jLJlMFUOOVrdTrACNoEXDSZ693K8=";
27 };
28
29 postPatch = ''
30 substituteInPlace pyproject.toml --replace \
31 " --cov --cov-report term --cov-report html" ""
32 '';
33
34 nativeBuildInputs = [
35 poetry-core
36 ];
37
38 propagatedBuildInputs = [
39 aiohttp
40 async-timeout
41 ] ++ lib.optionals (pythonOlder "3.9") [
42 backports-zoneinfo
43 ];
44
45 nativeCheckInputs = [
46 pytest-asyncio
47 pytest-timeout
48 pytestCheckHook
49 python-dotenv
50 ];
51
52 pythonImportsCheck = [
53 "aiopvpc"
54 ];
55
56 meta = with lib; {
57 description = "Python module to download Spanish electricity hourly prices (PVPC)";
58 homepage = "https://github.com/azogue/aiopvpc";
59 changelog = "https://github.com/azogue/aiopvpc/blob/v${version}/CHANGELOG.md";
60 license = with licenses; [ mit ];
61 maintainers = with maintainers; [ fab ];
62 };
63}