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 ]
43 ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];
44
45 pytestFlags = [
46 # RuntimeWarning: Can't run the Python asyncio tests because they're not installed
47 "-Wignore::RuntimeWarning"
48 "-Wignore::DeprecationWarning"
49 ];
50
51 disabledTests = [
52 # TypeError: RaisesGroup.__init__() got an unexpected keyword argument 'strict'
53 # https://github.com/python-trio/trio-asyncio/issues/154
54 "test_run_trio_task_errors"
55 "test_cancel_loop_with_tasks"
56 ];
57
58 nativeCheckInputs = [
59 pytest-trio
60 pytestCheckHook
61 ];
62
63 pythonImportsCheck = [ "trio_asyncio" ];
64
65 meta = with lib; {
66 changelog = "https://github.com/python-trio/trio-asyncio/blob/v${version}/docs/source/history.rst";
67 description = "Re-implementation of the asyncio mainloop on top of Trio";
68 homepage = "https://github.com/python-trio/trio-asyncio";
69 license = with licenses; [
70 asl20 # or
71 mit
72 ];
73 maintainers = with maintainers; [ dotlambda ];
74 };
75}