at master 2.7 kB view raw
1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchFromGitHub, 6 pythonOlder, 7 8 # build-system 9 setuptools-scm, 10 11 # dependencies 12 exceptiongroup, 13 idna, 14 sniffio, 15 typing-extensions, 16 17 # optionals 18 trio, 19 20 # tests 21 blockbuster, 22 hypothesis, 23 psutil, 24 pytest-mock, 25 pytest-xdist, 26 pytestCheckHook, 27 trustme, 28 uvloop, 29 30 # smoke tests 31 starlette, 32}: 33 34buildPythonPackage rec { 35 pname = "anyio"; 36 version = "4.10.0"; 37 pyproject = true; 38 39 disabled = pythonOlder "3.9"; 40 41 src = fetchFromGitHub { 42 owner = "agronholm"; 43 repo = "anyio"; 44 tag = version; 45 hash = "sha256-9nOGQTqdO3VzA9c97BpZqqwpll5O5+3gRvF/l2Y2ars="; 46 }; 47 48 build-system = [ setuptools-scm ]; 49 50 dependencies = [ 51 idna 52 sniffio 53 ] 54 ++ lib.optionals (pythonOlder "3.13") [ 55 typing-extensions 56 ] 57 ++ lib.optionals (pythonOlder "3.11") [ 58 exceptiongroup 59 ]; 60 61 optional-dependencies = { 62 trio = [ trio ]; 63 }; 64 65 nativeCheckInputs = [ 66 blockbuster 67 exceptiongroup 68 hypothesis 69 psutil 70 pytest-mock 71 pytest-xdist 72 pytestCheckHook 73 trustme 74 uvloop 75 ] 76 ++ optional-dependencies.trio; 77 78 pytestFlags = [ 79 "-Wignore::trio.TrioDeprecationWarning" 80 ]; 81 82 disabledTestMarks = [ 83 "network" 84 ]; 85 86 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin '' 87 # Work around "OSError: AF_UNIX path too long" 88 export TMPDIR="/tmp" 89 ''; 90 91 disabledTests = [ 92 # TypeError: __subprocess_run() got an unexpected keyword argument 'umask' 93 "test_py39_arguments" 94 # AttributeError: 'module' object at __main__ has no attribute '__file__' 95 "test_nonexistent_main_module" 96 # 3 second timeout expired 97 "test_keyboardinterrupt_during_test" 98 ] 99 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 100 # PermissionError: [Errno 1] Operation not permitted: '/dev/console' 101 "test_is_block_device" 102 103 # These tests become flaky under heavy load 104 "test_asyncio_run_sync_called" 105 "test_handshake_fail" 106 "test_run_in_custom_limiter" 107 "test_cancel_from_shielded_scope" 108 "test_start_task_soon_cancel_later" 109 110 # AssertionError: assert 'wheel' == 'nixbld' 111 "test_group" 112 ]; 113 114 disabledTestPaths = [ 115 # lots of DNS lookups 116 "tests/test_sockets.py" 117 ]; 118 119 __darwinAllowLocalNetworking = true; 120 121 pythonImportsCheck = [ "anyio" ]; 122 123 passthru.tests = { 124 inherit starlette; 125 }; 126 127 meta = with lib; { 128 changelog = "https://github.com/agronholm/anyio/blob/${src.tag}/docs/versionhistory.rst"; 129 description = "High level compatibility layer for multiple asynchronous event loop implementations on Python"; 130 homepage = "https://github.com/agronholm/anyio"; 131 license = licenses.mit; 132 maintainers = with maintainers; [ hexa ]; 133 }; 134}