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
|
{
lib,
stdenv,
aiofiles,
aioquic,
beautifulsoup4,
buildPythonPackage,
fetchFromGitHub,
gunicorn,
html5tagger,
httptools,
multidict,
pytest-asyncio,
pytestCheckHook,
sanic-ext,
sanic-routing,
sanic-testing,
setuptools,
tracerite,
typing-extensions,
ujson,
uvicorn,
uvloop,
websockets,
}:
buildPythonPackage rec {
pname = "sanic";
version = "25.3.0";
pyproject = true;
src = fetchFromGitHub {
owner = "sanic-org";
repo = "sanic";
tag = "v${version}";
hash = "sha256-tucLXWYPpALQrPYf+aiovKHYf2iouu6jezvNdukEu9w=";
};
build-system = [ setuptools ];
dependencies = [
aiofiles
httptools
html5tagger
multidict
sanic-routing
tracerite
typing-extensions
ujson
uvloop
websockets
];
optional-dependencies = {
ext = [ sanic-ext ];
http3 = [ aioquic ];
};
nativeCheckInputs = [
beautifulsoup4
gunicorn
pytest-asyncio
pytestCheckHook
sanic-testing
uvicorn
]
++ optional-dependencies.http3;
preCheck = ''
# Some tests depends on sanic on PATH
PATH="$out/bin:$PATH"
PYTHONPATH=$PWD:$PYTHONPATH
# needed for relative paths for some packages
cd tests
''
# Work around "OSError: AF_UNIX path too long"
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace worker/test_socket.py \
--replace-fail '"./test.sock"' '"/tmp/test.sock"'
'';
disabledTests = [
# EOFError: Ran out of input
"test_server_run_with_repl"
# InvalidStatusCode: server rejected WebSocket connection: HTTP 400
"test_websocket_route_with_subprotocols"
# nic.exceptions.SanicException: Cannot setup Sanic Simple Server without a path to a directory
"test_load_app_simple"
# ModuleNotFoundError: No module named '/build/source/tests/tests/static'
"test_input_is_dir"
# Racy, e.g. Address already in use
"test_logger_vhosts"
# Event loop is closed
"test_asyncio_server_no_start_serving"
"test_asyncio_server_start_serving"
"test_create_asyncio_server"
"test_create_server_main_convenience"
"test_create_server_main"
"test_create_server_no_startup"
"test_create_server_trigger_events"
"test_multiple_uvloop_configs_display_warning"
"test_uvloop_cannot_never_called_with_create_server"
];
disabledTestPaths = [
# We are not interested in benchmarks
"benchmark/"
# We are also not interested in typing
"typing/test_typing.py"
# occasionally hangs
"test_multiprocessing.py"
# Failed: async def functions are not natively supported.
"test_touchup.py"
];
# Avoid usage of nixpkgs-review in darwin since tests will compete usage
# for the same local port
__darwinAllowLocalNetworking = true;
pythonImportsCheck = [ "sanic" ];
meta = {
description = "Web server and web framework";
homepage = "https://github.com/sanic-org/sanic/";
changelog = "https://github.com/sanic-org/sanic/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ p0lyw0lf ];
mainProgram = "sanic";
};
}
|