summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/trio-asyncio/default.nix
blob: e29d707ab8971a198687478e0513950459c27662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  greenlet,
  trio,
  outcome,
  sniffio,
  exceptiongroup,
  pytest-trio,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
}:

buildPythonPackage rec {
  pname = "trio-asyncio";
  version = "0.15.0";
  pyproject = true;

  # https://github.com/python-trio/trio-asyncio/issues/160
  disabled = pythonAtLeast "3.14";

  src = fetchFromGitHub {
    owner = "python-trio";
    repo = "trio-asyncio";
    tag = "v${version}";
    hash = "sha256-6c+4sGEpCVC8wxBg+dYgkOwRAUOi/DTITrDx3M2koyE=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail '"pytest-runner"' ""
  '';

  build-system = [ setuptools ];

  dependencies = [
    greenlet
    trio
    outcome
    sniffio
  ]
  ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];

  pytestFlags = [
    # RuntimeWarning: Can't run the Python asyncio tests because they're not installed
    "-Wignore::RuntimeWarning"
    "-Wignore::DeprecationWarning"
  ];

  disabledTests = [
    # TypeError: RaisesGroup.__init__() got an unexpected keyword argument 'strict'
    # https://github.com/python-trio/trio-asyncio/issues/154
    "test_run_trio_task_errors"
    "test_cancel_loop_with_tasks"
  ];

  nativeCheckInputs = [
    pytest-trio
    pytestCheckHook
  ];

  pythonImportsCheck = [ "trio_asyncio" ];

  meta = {
    changelog = "https://github.com/python-trio/trio-asyncio/blob/v${version}/docs/source/history.rst";
    description = "Re-implementation of the asyncio mainloop on top of Trio";
    homepage = "https://github.com/python-trio/trio-asyncio";
    license = with lib.licenses; [
      asl20 # or
      mit
    ];
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}