@@ -1,130 +1,40 @@
1−{ lib
2−, buildPythonPackage
3−, fetchPypi
4−, httptools
5−, aiofiles
6−, websockets
7−, multidict
8−, uvloop
9−, ujson
10−, pytest
11−, gunicorn
12−, aiohttp
13−, beautifulsoup4
14−, pytest-sanic
15−, pytest-benchmark
16−
17−# required just httpcore / requests-async
18−, h11
19−, h2
20−, certifi
21−, chardet
22−, idna
23−, requests
24−, rfc3986
25−, uvicorn
1+{ lib, buildPythonPackage, fetchPypi
2+, aiofiles, httptools, httpx, multidict, ujson, uvloop, websockets
3+, pytestCheckHook, beautifulsoup4, gunicorn, httpcore, uvicorn
4+, pytest-asyncio, pytest-benchmark, pytest-dependency, pytest-sanic, pytest-sugar, pytestcov
265}:
276
28−let
29−
30− # This version of sanic depends on two packages that have been deprecated by
31− # their development teams:
32− #
33− # - requests-async [where first line of pypi says to use `http3` instead now]
34− # - httpcore [where the homepage redirects to `http3` now]
35− #
36− # Since no other packages in nixpkg depend on these right now, define these
37− # packages just as local dependencies here, to avoid bloat.
38−
39− httpcore = buildPythonPackage rec {
40− pname = "httpcore";
41− version = "0.3.0";
42− src = fetchPypi {
43− inherit pname version;
44− sha256 = "0n3bamaixxhcm27gf1ws3g6rkamvqx87087c88r6hyyl52si1ycn";
45− };
46−
47− propagatedBuildInputs = [ certifi chardet h11 h2 idna rfc3986 ];
48−
49− # relax pinned old version of h11
50− postConfigure = ''
51− substituteInPlace setup.py \
52− --replace "h11==0.8.*" "h11"
53− '';
54−
55− # LICENCE.md gets propagated without this, causing collisions
56− postInstall = ''
57− rm $out/LICENSE.md
58− '';
59− };
60−
61− requests-async = buildPythonPackage rec {
62− pname = "requests-async";
63− version = "0.5.0";
64− src = fetchPypi {
65− inherit pname version;
66− sha256 = "8731420451383196ecf2fd96082bfc8ae5103ada90aba185888499d7784dde6f";
67− };
68−
69− propagatedBuildInputs = [ requests httpcore ];
70−
71− # LICENCE.md gets propagated without this, causing collisions
72− postInstall = ''
73− rm $out/LICENSE.md
74− '';
75− };
76−
77−in
78−
797buildPythonPackage rec {
808 pname = "sanic";
81− version = "19.6.3";
9+ version = "20.9.1";
8210
8311 src = fetchPypi {
8412 inherit pname version;
85− sha256 = "0b1qqsvdjkibrw5kgr0pm7n7jzb1403132wjmb0lx3k5wyvqfi95";
13+ sha256 = "06p0lsxqbfbka2yaqlpp0bg5pf7ma44zi6kq7qbb6hhry48dp1w6";
8614 };
8715
16+ patchPhase = ''
17+ substituteInPlace setup.py \
18+ --replace '"multidict==5.0.0"' '"multidict"' \
19+ --replace '"httpx==0.15.4"' '"httpx"' \
20+ --replace '"httpcore==0.3.0"' '"httpcore"' \
21+ --replace '"pytest==5.2.1"' '"pytest"'
22+ '';
23+
8824 propagatedBuildInputs = [
89− httptools
90− aiofiles
91− websockets
92− multidict
93− requests-async
94− uvloop
95− ujson
25+ aiofiles httptools httpx multidict ujson uvloop websockets
9626 ];
9727
9828 checkInputs = [
99− pytest
100− gunicorn
101− aiohttp
102− beautifulsoup4
103− pytest-sanic
104− pytest-benchmark
105− uvicorn
29+ pytestCheckHook beautifulsoup4 gunicorn httpcore uvicorn
30+ pytest-asyncio pytest-benchmark pytest-dependency pytest-sanic pytest-sugar pytestcov
10631 ];
10732
108− # Sanic says it needs websockets 7.x, but the changelog for 8.x is actually
109− # nearly compatible with sanic's use. So relax this constraint, with a small
110− # required code change.
111− postConfigure = ''
112− substituteInPlace setup.py --replace \
113− "websockets>=7.0,<8.0" \
114− "websockets>=7.0,<9.0"
115− substituteInPlace sanic/websocket.py --replace \
116− "self.websocket.subprotocol = subprotocol" \
117− "self.websocket.subprotocol = subprotocol
118− self.websocket.is_client = False"
119− '';
120−
121− # 10/500 tests ignored due to missing directory and
122− # requiring network access
123− checkPhase = ''
124− pytest --ignore tests/test_blueprints.py \
125− --ignore tests/test_routes.py \
126− --ignore tests/test_worker.py
127− '';
33+ disabledTests = [
34+ "test_gunicorn" # No "examples" directory in pypi distribution.
35+ "test_logo" # Fails to filter out "DEBUG asyncio:selector_events.py:59 Using selector: EpollSelector"
36+ "test_zero_downtime" # No "examples.delayed_response.app" module in pypi distribution.
37+ ];
12838
12939 meta = with lib; {
13040 description = "A microframework based on uvloop, httptools, and learnings of flask";