2021-03-12 07:09:13 +00:00
|
|
|
{ lib, buildPythonPackage, fetchPypi, doCheck ? true
|
2021-05-03 20:48:10 +00:00
|
|
|
, aiofiles, httptools, multidict, sanic-routing, ujson, uvloop, websockets
|
|
|
|
, pytestCheckHook, beautifulsoup4, gunicorn, uvicorn, sanic-testing
|
|
|
|
, pytest-benchmark, pytest-sanic, pytest-sugar, pytestcov
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sanic";
|
2021-05-03 20:48:10 +00:00
|
|
|
version = "21.3.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-05-03 20:48:10 +00:00
|
|
|
sha256 = "1cbd12b9138b3ca69656286b0be91fff02b826e8cb72dd76a2ca8c5eb1288d8e";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
postPatch = ''
|
2021-05-03 20:48:10 +00:00
|
|
|
# Loosen dependency requirements.
|
2020-12-09 12:39:15 +00:00
|
|
|
substituteInPlace setup.py \
|
2021-05-03 20:48:10 +00:00
|
|
|
--replace '"pytest==5.2.1"' '"pytest"' \
|
|
|
|
--replace '"gunicorn==20.0.4"' '"gunicorn"' \
|
|
|
|
--replace '"pytest-sanic",' ""
|
|
|
|
# Patch a request headers test to allow brotli encoding
|
|
|
|
# (we build httpx with brotli support, upstream doesn't).
|
|
|
|
substituteInPlace tests/test_headers.py \
|
|
|
|
--replace "deflate\r\n" "deflate, br\r\n"
|
2020-12-09 12:39:15 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-05-03 20:48:10 +00:00
|
|
|
sanic-routing httptools uvloop ujson aiofiles websockets multidict
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-05-03 20:48:10 +00:00
|
|
|
sanic-testing gunicorn pytestcov beautifulsoup4 pytest-sanic pytest-sugar
|
|
|
|
pytest-benchmark pytestCheckHook uvicorn
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
inherit doCheck;
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
disabledTests = [
|
|
|
|
"test_gunicorn" # No "examples" directory in pypi distribution.
|
|
|
|
"test_zero_downtime" # No "examples.delayed_response.app" module in pypi distribution.
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
pythonImportsCheck = [ "sanic" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A microframework based on uvloop, httptools, and learnings of flask";
|
2021-05-03 20:48:10 +00:00
|
|
|
homepage = "https://github.com/sanic-org/sanic/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-05-03 20:48:10 +00:00
|
|
|
maintainers = with maintainers; [ costrouc AluisioASG ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|