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