Merge pull request #68321 from simonchatts/sanic
pythonPackages.sanic: 19.3.1 -> 19.6.3 (and fix websockets and other issues)
This commit is contained in:
commit
13ae3441ad
|
@ -3,7 +3,6 @@
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, click
|
, click
|
||||||
, click-default-group
|
, click-default-group
|
||||||
, sanic
|
|
||||||
, jinja2
|
, jinja2
|
||||||
, hupper
|
, hupper
|
||||||
, pint
|
, pint
|
||||||
|
@ -14,17 +13,20 @@
|
||||||
, black
|
, black
|
||||||
, aiohttp
|
, aiohttp
|
||||||
, beautifulsoup4
|
, beautifulsoup4
|
||||||
|
, uvicorn
|
||||||
|
, asgiref
|
||||||
|
, aiofiles
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "datasette";
|
pname = "datasette";
|
||||||
version = "0.28";
|
version = "0.29.3";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "simonw";
|
owner = "simonw";
|
||||||
repo = "datasette";
|
repo = "datasette";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "1m2s03gyq0ghjc3s0b5snpinisddywpgii2f0zqa3v4ljmzanx7h";
|
sha256 = "0cib7pd4z240ncck0pskzvizblhwkr42fsjpd719wdxy4scs7yqa";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ pytestrunner ];
|
buildInputs = [ pytestrunner ];
|
||||||
|
@ -32,11 +34,12 @@ buildPythonPackage rec {
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
click
|
click
|
||||||
click-default-group
|
click-default-group
|
||||||
sanic
|
|
||||||
jinja2
|
jinja2
|
||||||
hupper
|
hupper
|
||||||
pint
|
pint
|
||||||
pluggy
|
pluggy
|
||||||
|
uvicorn
|
||||||
|
aiofiles
|
||||||
];
|
];
|
||||||
|
|
||||||
checkInputs = [
|
checkInputs = [
|
||||||
|
@ -45,6 +48,7 @@ buildPythonPackage rec {
|
||||||
aiohttp
|
aiohttp
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
black
|
black
|
||||||
|
asgiref
|
||||||
];
|
];
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
|
@ -52,8 +56,9 @@ buildPythonPackage rec {
|
||||||
--replace "click-default-group==1.2" "click-default-group" \
|
--replace "click-default-group==1.2" "click-default-group" \
|
||||||
--replace "Sanic==0.7.0" "Sanic" \
|
--replace "Sanic==0.7.0" "Sanic" \
|
||||||
--replace "hupper==1.0" "hupper" \
|
--replace "hupper==1.0" "hupper" \
|
||||||
--replace "pint==0.8.1" "pint" \
|
--replace "pint~=0.8.1" "pint" \
|
||||||
--replace "Jinja2==2.10.1" "Jinja2"
|
--replace "Jinja2==2.10.1" "Jinja2" \
|
||||||
|
--replace "uvicorn~=0.8.4" "uvicorn"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# many tests require network access
|
# many tests require network access
|
||||||
|
|
|
@ -15,15 +15,76 @@
|
||||||
, pytest-sanic
|
, pytest-sanic
|
||||||
, pytest-sugar
|
, pytest-sugar
|
||||||
, pytest-benchmark
|
, pytest-benchmark
|
||||||
|
|
||||||
|
# required just httpcore / requests-async
|
||||||
|
, h11
|
||||||
|
, h2
|
||||||
|
, certifi
|
||||||
|
, chardet
|
||||||
|
, idna
|
||||||
|
, requests
|
||||||
|
, rfc3986
|
||||||
|
, uvicorn
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
# This version of sanic depends on two packages that have been deprecated by
|
||||||
|
# their development teams:
|
||||||
|
#
|
||||||
|
# - requests-async [where first line of pypi says to use `http3` instead now]
|
||||||
|
# - httpcore [where the homepage redirects to `http3` now]
|
||||||
|
#
|
||||||
|
# Since no other packages in nixpkg depend on these right now, define these
|
||||||
|
# packages just as local dependencies here, to avoid bloat.
|
||||||
|
|
||||||
|
httpcore = buildPythonPackage rec {
|
||||||
|
pname = "httpcore";
|
||||||
|
version = "0.3.0";
|
||||||
|
src = fetchPypi {
|
||||||
|
inherit pname version;
|
||||||
|
sha256 = "0n3bamaixxhcm27gf1ws3g6rkamvqx87087c88r6hyyl52si1ycn";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = [ certifi chardet h11 h2 idna rfc3986 ];
|
||||||
|
|
||||||
|
# relax pinned old version of h11
|
||||||
|
postConfigure = ''
|
||||||
|
substituteInPlace setup.py \
|
||||||
|
--replace "h11==0.8.*" "h11"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# LICENCE.md gets propagated without this, causing collisions
|
||||||
|
postInstall = ''
|
||||||
|
rm $out/LICENSE.md
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
requests-async = buildPythonPackage rec {
|
||||||
|
pname = "requests-async";
|
||||||
|
version = "0.5.0";
|
||||||
|
src = fetchPypi {
|
||||||
|
inherit pname version;
|
||||||
|
sha256 = "8731420451383196ecf2fd96082bfc8ae5103ada90aba185888499d7784dde6f";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = [ requests httpcore ];
|
||||||
|
|
||||||
|
# LICENCE.md gets propagated without this, causing collisions
|
||||||
|
postInstall = ''
|
||||||
|
rm $out/LICENSE.md
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "sanic";
|
pname = "sanic";
|
||||||
version = "19.3.1";
|
version = "19.6.3";
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
sha256 = "ce434eb154872ca64493a6c3a288f11fd10bca0de7be7bf9f1d0d063185e51ec";
|
sha256 = "0b1qqsvdjkibrw5kgr0pm7n7jzb1403132wjmb0lx3k5wyvqfi95";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
|
@ -31,6 +92,7 @@ buildPythonPackage rec {
|
||||||
aiofiles
|
aiofiles
|
||||||
websockets
|
websockets
|
||||||
multidict
|
multidict
|
||||||
|
requests-async
|
||||||
uvloop
|
uvloop
|
||||||
ujson
|
ujson
|
||||||
];
|
];
|
||||||
|
@ -44,11 +106,20 @@ buildPythonPackage rec {
|
||||||
pytest-sanic
|
pytest-sanic
|
||||||
pytest-sugar
|
pytest-sugar
|
||||||
pytest-benchmark
|
pytest-benchmark
|
||||||
|
uvicorn
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Sanic says it needs websockets 7.x, but the changelog for 8.x is actually
|
||||||
|
# nearly compatible with sanic's use. So relax this constraint, with a small
|
||||||
|
# required code change.
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
substituteInPlace setup.py \
|
substituteInPlace setup.py --replace \
|
||||||
--replace "websockets>=6.0,<7.0" "websockets"
|
"websockets>=7.0,<8.0" \
|
||||||
|
"websockets>=7.0,<9.0"
|
||||||
|
substituteInPlace sanic/websocket.py --replace \
|
||||||
|
"self.websocket.subprotocol = subprotocol" \
|
||||||
|
"self.websocket.subprotocol = subprotocol
|
||||||
|
self.websocket.is_client = False"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# 10/500 tests ignored due to missing directory and
|
# 10/500 tests ignored due to missing directory and
|
||||||
|
|
|
@ -43,6 +43,12 @@ buildPythonPackage rec {
|
||||||
pytest
|
pytest
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# LICENCE.md gets propagated without this, causing collisions
|
||||||
|
# see https://github.com/encode/uvicorn/issues/392
|
||||||
|
postInstall = ''
|
||||||
|
rm $out/LICENSE.md
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = https://www.uvicorn.org/;
|
homepage = https://www.uvicorn.org/;
|
||||||
description = "The lightning-fast ASGI server";
|
description = "The lightning-fast ASGI server";
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, pythonOlder
|
, pythonOlder
|
||||||
, pytest
|
, pytest
|
||||||
|
, stdenv
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
|
@ -18,6 +19,9 @@ buildPythonPackage rec {
|
||||||
|
|
||||||
disabled = pythonOlder "3.3";
|
disabled = pythonOlder "3.3";
|
||||||
|
|
||||||
|
# Tests fail on Darwin with `OSError: AF_UNIX path too long`
|
||||||
|
doCheck = !stdenv.isDarwin;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "WebSocket implementation in Python 3";
|
description = "WebSocket implementation in Python 3";
|
||||||
homepage = "https://github.com/aaugustin/websockets";
|
homepage = "https://github.com/aaugustin/websockets";
|
||||||
|
|
Loading…
Reference in New Issue