1{
2 lib,
3 buildPythonPackage,
4 aiohttp,
5 async-timeout,
6 chacha20poly1305-reuseable,
7 cryptography,
8 deepdiff,
9 fetchFromGitHub,
10 ifaddr,
11 mediafile,
12 miniaudio,
13 protobuf,
14 pydantic,
15 pyfakefs,
16 pytest-aiohttp,
17 pytest-asyncio,
18 pytest-httpserver,
19 pytest-timeout,
20 pytestCheckHook,
21 pythonAtLeast,
22 pythonOlder,
23 requests,
24 setuptools,
25 srptools,
26 stdenv,
27 tabulate,
28 tinytag,
29 zeroconf,
30}:
31
32buildPythonPackage rec {
33 pname = "pyatv";
34 version = "0.16.0";
35 pyproject = true;
36
37 disabled = pythonOlder "3.8";
38
39 src = fetchFromGitHub {
40 owner = "postlund";
41 repo = "pyatv";
42 rev = "refs/tags/v${version}";
43 hash = "sha256-yjPbSTmHoKnVwNArZw5mGf3Eh4Ei1+DkY9y2XRRy4YA=";
44 };
45
46 postPatch = ''
47 substituteInPlace setup.py \
48 --replace-fail "pytest-runner" ""
49 '';
50
51 pythonRelaxDeps = [
52 "aiohttp"
53 "async_timeout"
54 "bitarray"
55 "chacha20poly1305-reuseable"
56 "cryptography"
57 "ifaddr"
58 "mediafile"
59 "miniaudio"
60 "protobuf"
61 "requests"
62 "srptools"
63 "zeroconf"
64 ];
65
66 build-system = [ setuptools ];
67
68 dependencies = [
69 aiohttp
70 async-timeout
71 chacha20poly1305-reuseable
72 cryptography
73 ifaddr
74 mediafile
75 miniaudio
76 protobuf
77 pydantic
78 requests
79 srptools
80 tabulate
81 tinytag
82 zeroconf
83 ];
84
85 nativeCheckInputs = [
86 deepdiff
87 pyfakefs
88 pytest-aiohttp
89 pytest-asyncio
90 pytest-httpserver
91 pytest-timeout
92 pytestCheckHook
93 ];
94
95 disabledTests =
96 lib.optionals (pythonAtLeast "3.12") [
97 # https://github.com/postlund/pyatv/issues/2365
98 "test_simple_dispatch"
99 ]
100 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
101 # tests/protocols/raop/test_raop_functional.py::test_stream_retransmission[raop_properties2-2-True] - assert False
102 "test_stream_retransmission"
103 ];
104
105 disabledTestPaths = [
106 # Test doesn't work in the sandbox
107 "tests/protocols/companion/test_companion_auth.py"
108 "tests/protocols/mrp/test_mrp_auth.py"
109 ];
110
111 __darwinAllowLocalNetworking = true;
112
113 pythonImportsCheck = [ "pyatv" ];
114
115 meta = with lib; {
116 description = "Python client library for the Apple TV";
117 homepage = "https://github.com/postlund/pyatv";
118 changelog = "https://github.com/postlund/pyatv/blob/v${version}/CHANGES.md";
119 license = licenses.mit;
120 maintainers = with maintainers; [ fab ];
121 };
122}