nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 137 lines 2.8 kB view raw
1{ lib 2, stdenv 3, aiofiles 4, beautifulsoup4 5, buildPythonPackage 6, doCheck ? true 7, fetchFromGitHub 8, gunicorn 9, httptools 10, multidict 11, pytest-asyncio 12, pytest-benchmark 13, pytest-sugar 14, pytestCheckHook 15, pythonOlder 16, pythonAtLeast 17, sanic-routing 18, sanic-testing 19, ujson 20, uvicorn 21, uvloop 22, websockets 23}: 24 25buildPythonPackage rec { 26 pname = "sanic"; 27 version = "22.3.2"; 28 format = "setuptools"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 owner = "sanic-org"; 34 repo = pname; 35 rev = "v${version}"; 36 hash = "sha256-4zdPp3X22dfZ5YlW3G5/OqeUxrt+NiFO9dk2XjEKXEg="; 37 }; 38 39 postPatch = '' 40 # Loosen dependency requirements. 41 substituteInPlace setup.py \ 42 --replace "pytest==6.2.5" "pytest" \ 43 --replace "gunicorn==20.0.4" "gunicorn" 44 ''; 45 46 propagatedBuildInputs = [ 47 aiofiles 48 httptools 49 multidict 50 sanic-routing 51 ujson 52 uvloop 53 websockets 54 ]; 55 56 checkInputs = [ 57 beautifulsoup4 58 gunicorn 59 pytest-asyncio 60 pytestCheckHook 61 sanic-testing 62 uvicorn 63 ]; 64 65 inherit doCheck; 66 67 preCheck = '' 68 # Some tests depends on sanic on PATH 69 PATH="$out/bin:$PATH" 70 PYTHONPATH=$PWD:$PYTHONPATH 71 72 # needed for relative paths for some packages 73 cd tests 74 '' + lib.optionalString stdenv.isDarwin '' 75 # OSError: [Errno 24] Too many open files 76 ulimit -n 1024 77 ''; 78 79 # uvloop usage is buggy 80 #SANIC_NO_UVLOOP = true; 81 82 pytestFlagsArray = [ 83 "--asyncio-mode=auto" 84 ]; 85 86 disabledTests = [ 87 # Fails to parse cmdline arguments 88 "test_dev" 89 "test_auto_reload" 90 "test_host_port_ipv6_loopback" 91 "test_num_workers" 92 "test_debug" 93 "test_access_logs" 94 "test_noisy_exceptions" 95 # OSError: foo 96 "test_bad_headers" 97 "test_create_server_trigger_events" 98 "test_json_body_requests" 99 "test_missing_startup_raises_exception" 100 "test_no_body_requests" 101 "test_oserror_warning" 102 "test_running_multiple_offset_warning" 103 "test_streaming_body_requests" 104 "test_trigger_before_events_create_server" 105 "test_keep_alive_connection_context" 106 # Racy tests 107 "test_keep_alive_client_timeout" 108 "test_keep_alive_server_timeout" 109 "test_zero_downtime" 110 ]; 111 112 disabledTestPaths = [ 113 # We are not interested in benchmarks 114 "benchmark/" 115 # unable to create async loop 116 "test_app.py" 117 "test_asgi.py" 118 # occasionally hangs 119 "test_multiprocessing.py" 120 ]; 121 122 # avoid usage of nixpkgs-review in darwin since tests will compete usage 123 # for the same local port 124 __darwinAllowLocalNetworking = true; 125 126 pythonImportsCheck = [ 127 "sanic" 128 ]; 129 130 meta = with lib; { 131 broken = stdenv.isDarwin; 132 description = "Web server and web framework"; 133 homepage = "https://github.com/sanic-org/sanic/"; 134 license = licenses.mit; 135 maintainers = with maintainers; [ costrouc AluisioASG ]; 136 }; 137}