1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 attrs,
12 exceptiongroup,
13 idna,
14 outcome,
15 sniffio,
16 sortedcontainers,
17
18 # tests
19 astor,
20 jedi,
21 pyopenssl,
22 pytestCheckHook,
23 pytest-trio,
24 trustme,
25}:
26
27let
28 # escape infinite recursion with pytest-trio
29 pytest-trio' = (pytest-trio.override { trio = null; }).overrideAttrs {
30 # `pythonRemoveDeps` is not working properly
31 dontCheckRuntimeDeps = true;
32 doCheck = false;
33 pythonImportsCheck = [ ];
34 };
35in
36buildPythonPackage rec {
37 pname = "trio";
38 version = "0.30.0";
39 pyproject = true;
40
41 disabled = pythonOlder "3.8";
42
43 src = fetchFromGitHub {
44 owner = "python-trio";
45 repo = "trio";
46 tag = "v${version}";
47 hash = "sha256-spYHwVq3iNhnZQf2z7aTyDuSCiSl3X5PD6siXqLC4EA=";
48 };
49
50 build-system = [ setuptools ];
51
52 dependencies = [
53 attrs
54 idna
55 outcome
56 sniffio
57 sortedcontainers
58 ]
59 ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];
60
61 __darwinAllowLocalNetworking = true;
62
63 nativeCheckInputs = [
64 astor
65 jedi
66 pyopenssl
67 pytestCheckHook
68 pytest-trio'
69 trustme
70 ];
71
72 preCheck = ''
73 export HOME=$TMPDIR
74 # $out is first in path which causes "import file mismatch"
75 PYTHONPATH=$PWD/src:$PYTHONPATH
76 '';
77
78 pytestFlags = [
79 "-Wignore::DeprecationWarning"
80 ];
81
82 # It appears that the build sandbox doesn't include /etc/services, and these tests try to use it.
83 disabledTests = [
84 "getnameinfo"
85 "SocketType_resolve"
86 "getprotobyname"
87 "waitpid"
88 "static_tool_sees_all_symbols"
89 # tests pytest more than python
90 "fallback_when_no_hook_claims_it"
91 # requires mypy
92 "test_static_tool_sees_class_members"
93 ];
94
95 disabledTestPaths = [
96 # linters
97 "src/trio/_tests/tools/test_gen_exports.py"
98 ];
99
100 meta = {
101 changelog = "https://github.com/python-trio/trio/blob/${src.tag}/docs/source/history.rst";
102 description = "Async/await-native I/O library for humans and snake people";
103 homepage = "https://github.com/python-trio/trio";
104 license = with lib.licenses; [
105 mit
106 asl20
107 ];
108 maintainers = with lib.maintainers; [ catern ];
109 };
110}