1{ lib, buildPythonPackage, fetchPypi, pythonOlder
2, attrs
3, sortedcontainers
4, async_generator
5, exceptiongroup
6, idna
7, outcome
8, pytestCheckHook
9, pyopenssl
10, trustme
11, sniffio
12, stdenv
13, jedi
14, astor
15, yapf
16, coreutils
17}:
18
19buildPythonPackage rec {
20 pname = "trio";
21 version = "0.22.0";
22 format = "setuptools";
23 disabled = pythonOlder "3.7";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-zmjxxUAKR7E3xaTecsfJAb1OeiT73r/ptB3oxsBOqs8=";
28 };
29
30 propagatedBuildInputs = [
31 attrs
32 sortedcontainers
33 async_generator
34 idna
35 outcome
36 sniffio
37 ] ++ lib.optionals (pythonOlder "3.11") [
38 exceptiongroup
39 ];
40
41 # tests are failing on Darwin
42 doCheck = !stdenv.isDarwin;
43
44 nativeCheckInputs = [
45 astor
46 jedi
47 pyopenssl
48 pytestCheckHook
49 trustme
50 yapf
51 ];
52
53 preCheck = ''
54 substituteInPlace trio/tests/test_subprocess.py \
55 --replace "/bin/sleep" "${coreutils}/bin/sleep"
56 '';
57
58 # It appears that the build sandbox doesn't include /etc/services, and these tests try to use it.
59 disabledTests = [
60 "getnameinfo"
61 "SocketType_resolve"
62 "getprotobyname"
63 "waitpid"
64 "static_tool_sees_all_symbols"
65 # tests pytest more than python
66 "fallback_when_no_hook_claims_it"
67 ];
68
69 pytestFlagsArray = [
70 "-W" "ignore::DeprecationWarning"
71 ];
72
73 meta = {
74 description = "An async/await-native I/O library for humans and snake people";
75 homepage = "https://github.com/python-trio/trio";
76 license = with lib.licenses; [ mit asl20 ];
77 maintainers = with lib.maintainers; [ catern ];
78 };
79}