1{ lib, buildPythonPackage, fetchPypi, doCheck ? true
2, aiofiles, httptools, multidict, sanic-routing, ujson, uvloop, websockets
3, pytestCheckHook, beautifulsoup4, gunicorn, uvicorn, sanic-testing
4, pytest-benchmark, pytest-sanic, pytest-sugar, pytestcov
5}:
6
7buildPythonPackage rec {
8 pname = "sanic";
9 version = "21.3.4";
10
11 src = fetchPypi {
12 inherit pname version;
13 sha256 = "1cbd12b9138b3ca69656286b0be91fff02b826e8cb72dd76a2ca8c5eb1288d8e";
14 };
15
16 postPatch = ''
17 # Loosen dependency requirements.
18 substituteInPlace setup.py \
19 --replace '"pytest==5.2.1"' '"pytest"' \
20 --replace '"gunicorn==20.0.4"' '"gunicorn"' \
21 --replace '"pytest-sanic",' ""
22 # Patch a request headers test to allow brotli encoding
23 # (we build httpx with brotli support, upstream doesn't).
24 substituteInPlace tests/test_headers.py \
25 --replace "deflate\r\n" "deflate, br\r\n"
26 '';
27
28 propagatedBuildInputs = [
29 sanic-routing httptools uvloop ujson aiofiles websockets multidict
30 ];
31
32 checkInputs = [
33 sanic-testing gunicorn pytestcov beautifulsoup4 pytest-sanic pytest-sugar
34 pytest-benchmark pytestCheckHook uvicorn
35 ];
36
37 inherit doCheck;
38
39 disabledTests = [
40 # No "examples" directory in pypi distribution
41 "test_gunicorn"
42 "test_zero_downtime"
43 # flaky
44 "test_keep_alive_client_timeout"
45 "test_reloader_live"
46 ];
47
48 __darwinAllowLocalNetworking = true;
49
50 pythonImportsCheck = [ "sanic" ];
51
52 meta = with lib; {
53 description = "A microframework based on uvloop, httptools, and learnings of flask";
54 homepage = "https://github.com/sanic-org/sanic/";
55 license = licenses.mit;
56 maintainers = with maintainers; [ costrouc AluisioASG ];
57 };
58}