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