Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 3.0 kB view raw
1{ lib 2, stdenv 3, aiofiles 4, beautifulsoup4 5, buildPythonPackage 6, doCheck ? !stdenv.isDarwin # on Darwin, tests fail but pkg still works 7, fetchFromGitHub 8, gunicorn 9, httptools 10, multidict 11, pytest-asyncio 12, pytestCheckHook 13, pythonOlder 14, pythonAtLeast 15, sanic-routing 16, sanic-testing 17, setuptools 18, ujson 19, uvicorn 20, uvloop 21, websockets 22, aioquic 23}: 24 25buildPythonPackage rec { 26 pname = "sanic"; 27 version = "22.12.0"; 28 format = "pyproject"; 29 30 disabled = pythonOlder "3.7"; 31 32 src = fetchFromGitHub { 33 owner = "sanic-org"; 34 repo = pname; 35 rev = "refs/tags/v${version}"; 36 hash = "sha256-Vj780rP5rJ+YsMWlb3BR9LTKT/nTt0C2H3J0X9sysj8="; 37 }; 38 39 nativeBuildInputs = [ 40 setuptools 41 ]; 42 43 propagatedBuildInputs = [ 44 aiofiles 45 aioquic 46 httptools 47 multidict 48 sanic-routing 49 ujson 50 uvloop 51 websockets 52 ]; 53 54 nativeCheckInputs = [ 55 beautifulsoup4 56 gunicorn 57 pytest-asyncio 58 pytestCheckHook 59 sanic-testing 60 uvicorn 61 ]; 62 63 inherit doCheck; 64 65 preCheck = '' 66 # Some tests depends on sanic on PATH 67 PATH="$out/bin:$PATH" 68 PYTHONPATH=$PWD:$PYTHONPATH 69 70 # needed for relative paths for some packages 71 cd tests 72 '' + lib.optionalString stdenv.isDarwin '' 73 # OSError: [Errno 24] Too many open files 74 ulimit -n 1024 75 ''; 76 77 # uvloop usage is buggy 78 #SANIC_NO_UVLOOP = true; 79 80 pytestFlagsArray = [ 81 "--asyncio-mode=auto" 82 "-vvv" 83 ]; 84 85 disabledTests = [ 86 # Require networking 87 "test_full_message" 88 # Server mode mismatch (debug vs production) 89 "test_num_workers" 90 # Racy tests 91 "test_keep_alive_client_timeout" 92 "test_keep_alive_server_timeout" 93 "test_zero_downtime" 94 # sanic.exceptions.SanicException: Cannot setup Sanic Simple Server without a path to a directory 95 "test_load_app_simple" 96 # create defunct python processes 97 "test_reloader_live" 98 "test_reloader_live_with_dir" 99 "test_reload_listeners" 100 # crash the python interpreter 101 "test_host_port_localhost" 102 "test_host_port" 103 "test_server_run" 104 # NoneType object is not subscriptable 105 "test_serve_app_implicit" 106 # AssertionError: assert [] == ['Restarting a process', 'Begin restart termination', 'Starting a process'] 107 "test_default_reload_shutdown_order" 108 # App not found. 109 "test_input_is_dir" 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 = [ "sanic" ]; 127 128 meta = with lib; { 129 description = "Web server and web framework"; 130 homepage = "https://github.com/sanic-org/sanic/"; 131 changelog = "https://github.com/sanic-org/sanic/releases/tag/v${version}"; 132 license = licenses.mit; 133 maintainers = with maintainers; [ costrouc AluisioASG ]; 134 }; 135}