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.14.1";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "python-trio";
25 repo = "trio-asyncio";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-634fcYAn5J1WW71J/USAMkJaZI8JmKoQneQEhz2gYFc=";
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 ];
49
50 nativeCheckInputs = [
51 pytest-trio
52 pytestCheckHook
53 ];
54
55 pythonImportsCheck = [ "trio_asyncio" ];
56
57 meta = with lib; {
58 changelog = "https://github.com/python-trio/trio-asyncio/blob/v${version}/docs/source/history.rst";
59 description = "Re-implementation of the asyncio mainloop on top of Trio";
60 homepage = "https://github.com/python-trio/trio-asyncio";
61 license = with licenses; [
62 asl20 # or
63 mit
64 ];
65 maintainers = with maintainers; [ dotlambda ];
66 };
67}