1{ lib
2, buildPythonPackage
3, fetchPypi
4, trio
5, outcome
6, sniffio
7, pytest-trio
8, pytestCheckHook
9, pythonAtLeast
10, pythonOlder
11}:
12
13buildPythonPackage rec {
14 pname = "trio-asyncio";
15 version = "0.12.0";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchPypi {
21 pname = "trio_asyncio";
22 inherit version;
23 sha256 = "824be23b0c678c0df942816cdb57b92a8b94f264fffa89f04626b0ba2d009768";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace "'pytest-runner'" ""
29 '';
30
31 propagatedBuildInputs = [
32 trio
33 outcome
34 sniffio
35 ];
36
37 nativeCheckInputs = [
38 pytest-trio
39 pytestCheckHook
40 ];
41
42 pytestFlagsArray = [
43 # https://github.com/python-trio/trio-asyncio/issues/112
44 "-W" "ignore::DeprecationWarning"
45 # trio.MultiError is deprecated since Trio 0.22.0; use BaseExceptionGroup (on Python 3.11 and later) or exceptiongroup.BaseExceptionGroup (earlier versions) instead (https://github.com/python-trio/trio/issues/2211)
46 "-W" "ignore::trio.TrioDeprecationWarning"
47 ];
48
49 disabledTestPaths = [
50 "tests/python" # tries to import internal API test.test_asyncio
51 ];
52
53 disabledTests = lib.optionals (pythonAtLeast "3.11") [
54 "test_run_task"
55 ];
56
57 pythonImportsCheck = [
58 "trio_asyncio"
59 ];
60
61 meta = with lib; {
62 description = "Re-implementation of the asyncio mainloop on top of Trio";
63 homepage = "https://github.com/python-trio/trio-asyncio";
64 license = with licenses; [ asl20 /* or */ mit ];
65 maintainers = with maintainers; [ dotlambda ];
66 };
67}