at master 2.9 kB view raw
1{ 2 lib, 3 stdenv, 4 aiofiles, 5 aioquic, 6 beautifulsoup4, 7 buildPythonPackage, 8 fetchFromGitHub, 9 gunicorn, 10 html5tagger, 11 httptools, 12 multidict, 13 pytest-asyncio, 14 pytestCheckHook, 15 pythonOlder, 16 sanic-ext, 17 sanic-routing, 18 sanic-testing, 19 setuptools, 20 tracerite, 21 typing-extensions, 22 ujson, 23 uvicorn, 24 uvloop, 25 websockets, 26}: 27 28buildPythonPackage rec { 29 pname = "sanic"; 30 version = "25.3.0"; 31 pyproject = true; 32 33 disabled = pythonOlder "3.7"; 34 35 src = fetchFromGitHub { 36 owner = "sanic-org"; 37 repo = "sanic"; 38 tag = "v${version}"; 39 hash = "sha256-tucLXWYPpALQrPYf+aiovKHYf2iouu6jezvNdukEu9w="; 40 }; 41 42 build-system = [ setuptools ]; 43 44 dependencies = [ 45 aiofiles 46 httptools 47 html5tagger 48 multidict 49 sanic-routing 50 tracerite 51 typing-extensions 52 ujson 53 uvloop 54 websockets 55 ]; 56 57 optional-dependencies = { 58 ext = [ sanic-ext ]; 59 http3 = [ aioquic ]; 60 }; 61 62 nativeCheckInputs = [ 63 beautifulsoup4 64 gunicorn 65 pytest-asyncio 66 pytestCheckHook 67 sanic-testing 68 uvicorn 69 ] 70 ++ optional-dependencies.http3; 71 72 preCheck = '' 73 # Some tests depends on sanic on PATH 74 PATH="$out/bin:$PATH" 75 PYTHONPATH=$PWD:$PYTHONPATH 76 77 # needed for relative paths for some packages 78 cd tests 79 '' 80 # Work around "OSError: AF_UNIX path too long" 81 + lib.optionalString stdenv.hostPlatform.isDarwin '' 82 substituteInPlace worker/test_socket.py \ 83 --replace-fail '"./test.sock"' '"/tmp/test.sock"' 84 ''; 85 86 disabledTests = [ 87 # EOFError: Ran out of input 88 "test_server_run_with_repl" 89 # InvalidStatusCode: server rejected WebSocket connection: HTTP 400 90 "test_websocket_route_with_subprotocols" 91 # nic.exceptions.SanicException: Cannot setup Sanic Simple Server without a path to a directory 92 "test_load_app_simple" 93 # ModuleNotFoundError: No module named '/build/source/tests/tests/static' 94 "test_input_is_dir" 95 # Racy, e.g. Address already in use 96 "test_logger_vhosts" 97 # Event loop is closed 98 "test_create_server_trigger_events" 99 ]; 100 101 disabledTestPaths = [ 102 # We are not interested in benchmarks 103 "benchmark/" 104 # We are also not interested in typing 105 "typing/test_typing.py" 106 # occasionally hangs 107 "test_multiprocessing.py" 108 # Failed: async def functions are not natively supported. 109 "test_touchup.py" 110 ]; 111 112 # Avoid usage of nixpkgs-review in darwin since tests will compete usage 113 # for the same local port 114 __darwinAllowLocalNetworking = true; 115 116 pythonImportsCheck = [ "sanic" ]; 117 118 meta = with lib; { 119 description = "Web server and web framework"; 120 homepage = "https://github.com/sanic-org/sanic/"; 121 changelog = "https://github.com/sanic-org/sanic/releases/tag/${src.tag}"; 122 license = licenses.mit; 123 maintainers = with maintainers; [ p0lyw0lf ]; 124 mainProgram = "sanic"; 125 }; 126}