1{ lib
2, aiohttp
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, pytestCheckHook
7, pythonOlder
8, pythonAtLeast
9, poetry-core
10, pytest-aiohttp
11, pytest-asyncio
12}:
13
14buildPythonPackage rec {
15 pname = "hyperion-py";
16 version = "0.7.5";
17 disabled = pythonOlder "3.8";
18 format = "pyproject";
19
20 src = fetchFromGitHub {
21 owner = "dermotduffy";
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "sha256-arcnpCQsRuiWCrAz/t4TCjTe8DRDtRuzYp8k7nnjGDk=";
25 };
26
27 patches = [
28 (fetchpatch {
29 # python3.10 compat: Drop loop kwarg in asyncio.sleep call
30 url = "https://github.com/dermotduffy/hyperion-py/commit/f02af52fcce17888984c99bfc03935e372011394.patch";
31 hash = "sha256-4nfsQVxd77VV9INwNxTyFRDlAjwdTYqfSGuF487hFCs=";
32 })
33 ];
34
35 nativeBuildInputs = [
36 poetry-core
37 ];
38
39 propagatedBuildInputs = [
40 aiohttp
41 ];
42
43 checkInputs = [
44 pytest-asyncio
45 pytest-aiohttp
46 pytestCheckHook
47 ];
48
49 pytestFlagsArray = [
50 # pytest-asyncio 0.17.0 compat
51 "--asyncio-mode=auto"
52 ];
53
54 postPatch = ''
55 substituteInPlace pyproject.toml \
56 --replace " --timeout=9 --cov=hyperion" ""
57 '';
58
59 pythonImportsCheck = [ "hyperion" ];
60
61 meta = with lib; {
62 description = "Python package for Hyperion Ambient Lighting";
63 homepage = "https://github.com/dermotduffy/hyperion-py";
64 license = licenses.mit;
65 maintainers = with maintainers; [ fab ];
66 };
67}