about summary refs log tree commit diff
path: root/pkgs/development/python-modules/trio/default.nix
blob: fb985e890a77f9f07b26c413a48c7ad2bd6c6d2a (plain) (blame)
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
78
79
{ lib, buildPythonPackage, fetchPypi, pythonOlder
, attrs
, sortedcontainers
, async-generator
, exceptiongroup
, idna
, outcome
, pytestCheckHook
, pyopenssl
, trustme
, sniffio
, stdenv
, jedi
, astor
, yapf
, coreutils
}:

buildPythonPackage rec {
  pname = "trio";
  version = "0.22.0";
  format = "setuptools";
  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-zmjxxUAKR7E3xaTecsfJAb1OeiT73r/ptB3oxsBOqs8=";
  };

  propagatedBuildInputs = [
    attrs
    sortedcontainers
    async-generator
    idna
    outcome
    sniffio
  ] ++ lib.optionals (pythonOlder "3.11") [
    exceptiongroup
  ];

  # tests are failing on Darwin
  doCheck = !stdenv.isDarwin;

  nativeCheckInputs = [
    astor
    jedi
    pyopenssl
    pytestCheckHook
    trustme
    yapf
  ];

  preCheck = ''
    substituteInPlace trio/tests/test_subprocess.py \
      --replace "/bin/sleep" "${coreutils}/bin/sleep"
  '';

  # It appears that the build sandbox doesn't include /etc/services, and these tests try to use it.
  disabledTests = [
    "getnameinfo"
    "SocketType_resolve"
    "getprotobyname"
    "waitpid"
    "static_tool_sees_all_symbols"
    # tests pytest more than python
    "fallback_when_no_hook_claims_it"
  ];

  pytestFlagsArray = [
    "-W" "ignore::DeprecationWarning"
  ];

  meta = {
    description = "An async/await-native I/O library for humans and snake people";
    homepage = "https://github.com/python-trio/trio";
    license = with lib.licenses; [ mit asl20 ];
    maintainers = with lib.maintainers; [ catern ];
  };
}