Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchFromGitHub, 6 pythonOlder, 7 8 # build-system 9 setuptools, 10 setuptools-scm, 11 12 # dependencies 13 exceptiongroup, 14 idna, 15 sniffio, 16 typing-extensions, 17 18 # optionals 19 trio, 20 21 # tests 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.3.0"; 37 pyproject = true; 38 39 disabled = pythonOlder "3.8"; 40 41 src = fetchFromGitHub { 42 owner = "agronholm"; 43 repo = pname; 44 rev = "refs/tags/${version}"; 45 hash = "sha256-y58DQiTD0ZKaBNf0cA3MFE+7F68Svrl+Idz6BZY7HWQ="; 46 }; 47 48 nativeBuildInputs = [ 49 setuptools 50 setuptools-scm 51 ]; 52 53 propagatedBuildInputs = 54 [ 55 idna 56 sniffio 57 ] 58 ++ lib.optionals (pythonOlder "3.11") [ 59 exceptiongroup 60 typing-extensions 61 ]; 62 63 passthru.optional-dependencies = { 64 trio = [ trio ]; 65 }; 66 67 # trustme uses pyopenssl 68 doCheck = !(stdenv.isDarwin && stdenv.isAarch64); 69 70 nativeCheckInputs = [ 71 exceptiongroup 72 hypothesis 73 psutil 74 pytest-mock 75 pytest-xdist 76 pytestCheckHook 77 trustme 78 uvloop 79 ] ++ passthru.optional-dependencies.trio; 80 81 pytestFlagsArray = [ 82 "-W" 83 "ignore::trio.TrioDeprecationWarning" 84 "-m" 85 "'not network'" 86 ]; 87 88 disabledTests = lib.optionals (stdenv.isx86_64 && stdenv.isDarwin) [ 89 # PermissionError: [Errno 1] Operation not permitted: '/dev/console' 90 "test_is_block_device" 91 ]; 92 93 disabledTestPaths = [ 94 # lots of DNS lookups 95 "tests/test_sockets.py" 96 ]; 97 98 __darwinAllowLocalNetworking = true; 99 100 pythonImportsCheck = [ "anyio" ]; 101 102 passthru.tests = { 103 inherit starlette; 104 }; 105 106 meta = with lib; { 107 changelog = "https://github.com/agronholm/anyio/blob/${src.rev}/docs/versionhistory.rst"; 108 description = "High level compatibility layer for multiple asynchronous event loop implementations on Python"; 109 homepage = "https://github.com/agronholm/anyio"; 110 license = licenses.mit; 111 maintainers = with maintainers; [ hexa ]; 112 }; 113}