1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 greenlet,
7 trio,
8 outcome,
9 sniffio,
10 exceptiongroup,
11 pytest-trio,
12 pytestCheckHook,
13 pythonOlder,
14}:
15
16buildPythonPackage rec {
17 pname = "trio-asyncio";
18 version = "0.15.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "python-trio";
25 repo = "trio-asyncio";
26 tag = "v${version}";
27 hash = "sha256-6c+4sGEpCVC8wxBg+dYgkOwRAUOi/DTITrDx3M2koyE=";
28 };
29
30 postPatch = ''
31 substituteInPlace setup.py \
32 --replace-fail '"pytest-runner"' ""
33 '';
34
35 build-system = [ setuptools ];
36
37 dependencies = [
38 greenlet
39 trio
40 outcome
41 sniffio
42 ] ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];
43
44 pytestFlagsArray = [
45 # RuntimeWarning: Can't run the Python asyncio tests because they're not installed
46 "-W"
47 "ignore::RuntimeWarning"
48 "-W"
49 "ignore::DeprecationWarning"
50 ];
51
52 disabledTests = [
53 # TypeError: RaisesGroup.__init__() got an unexpected keyword argument 'strict'
54 # https://github.com/python-trio/trio-asyncio/issues/154
55 "test_run_trio_task_errors"
56 "test_cancel_loop_with_tasks"
57 ];
58
59 nativeCheckInputs = [
60 pytest-trio
61 pytestCheckHook
62 ];
63
64 pythonImportsCheck = [ "trio_asyncio" ];
65
66 meta = with lib; {
67 changelog = "https://github.com/python-trio/trio-asyncio/blob/v${version}/docs/source/history.rst";
68 description = "Re-implementation of the asyncio mainloop on top of Trio";
69 homepage = "https://github.com/python-trio/trio-asyncio";
70 license = with licenses; [
71 asl20 # or
72 mit
73 ];
74 maintainers = with maintainers; [ dotlambda ];
75 };
76}