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