1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, setuptools-scm
7, idna
8, sniffio
9, typing-extensions
10, curio
11, hypothesis
12, mock
13, pytest-mock
14, pytestCheckHook
15, trio
16, trustme
17, uvloop
18}:
19
20buildPythonPackage rec {
21 pname = "anyio";
22 version = "3.3.2";
23 format = "pyproject";
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "agronholm";
28 repo = pname;
29 rev = version;
30 sha256 = "sha256-XBIrFb/XDneaOf/TeHxyeEfyQ7qQcWO7LJF0k1f4Ark=";
31 };
32
33 preBuild = ''
34 export SETUPTOOLS_SCM_PRETEND_VERSION=${version}
35 '';
36
37 nativeBuildInputs = [
38 setuptools-scm
39 ];
40
41 propagatedBuildInputs = [
42 idna
43 sniffio
44 ] ++ lib.optionals (pythonOlder "3.8") [
45 typing-extensions
46 ];
47
48 checkInputs = [
49 curio
50 hypothesis
51 pytest-mock
52 pytestCheckHook
53 trio
54 trustme
55 uvloop
56 ] ++ lib.optionals (pythonOlder "3.8") [
57 mock
58 ];
59
60 disabledTests = [
61 # block devices access
62 "test_is_block_device"
63 ];
64
65 disabledTestPaths = [
66 # lots of DNS lookups
67 "tests/test_sockets.py"
68 ] ++ lib.optionals stdenv.isDarwin [
69 # darwin sandboxing limitations
70 "tests/streams/test_tls.py"
71 ];
72
73 pythonImportsCheck = [ "anyio" ];
74
75 meta = with lib; {
76 description = "High level compatibility layer for multiple asynchronous event loop implementations on Python";
77 homepage = "https://github.com/agronholm/anyio";
78 license = licenses.mit;
79 maintainers = with maintainers; [ hexa ];
80 };
81}