1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pytestCheckHook,
8 pythonOlder,
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 hash = "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 = [ poetry-core ];
36
37 propagatedBuildInputs = [ aiohttp ];
38
39 nativeCheckInputs = [
40 pytest-asyncio
41 pytest-aiohttp
42 pytestCheckHook
43 ];
44
45 pytestFlagsArray = [
46 # pytest-asyncio 0.17.0 compat
47 "--asyncio-mode=auto"
48 ];
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace " --timeout=9 --cov=hyperion" ""
53 '';
54
55 pythonImportsCheck = [ "hyperion" ];
56
57 meta = with lib; {
58 description = "Python package for Hyperion Ambient Lighting";
59 homepage = "https://github.com/dermotduffy/hyperion-py";
60 license = licenses.mit;
61 maintainers = with maintainers; [ fab ];
62 };
63}