2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
2021-12-06 16:07:01 +00:00
|
|
|
, stdenv
|
2021-06-28 23:13:55 +00:00
|
|
|
, aiofiles
|
|
|
|
, beautifulsoup4
|
|
|
|
, buildPythonPackage
|
|
|
|
, doCheck ? true
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gunicorn
|
|
|
|
, httptools
|
|
|
|
, multidict
|
|
|
|
, pytest-asyncio
|
|
|
|
, pytest-benchmark
|
|
|
|
, pytest-sugar
|
|
|
|
, pytestCheckHook
|
2021-12-26 17:43:05 +00:00
|
|
|
, pythonOlder
|
2021-06-28 23:13:55 +00:00
|
|
|
, sanic-routing
|
|
|
|
, sanic-testing
|
|
|
|
, ujson
|
|
|
|
, uvicorn
|
|
|
|
, uvloop
|
|
|
|
, websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sanic";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "21.9.3";
|
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sanic-org";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-12-26 17:43:05 +00:00
|
|
|
sha256 = "0m18jdw1mvf7jhpnrxhm96p24pxvv0h9m71a8c7sqqkwnnpa3p5i";
|
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-12-06 16:07:01 +00:00
|
|
|
--replace '"pytest==6.2.5"' '"pytest"' \
|
2021-05-03 20:48:10 +00:00
|
|
|
--replace '"gunicorn==20.0.4"' '"gunicorn"' \
|
2021-06-28 23:13:55 +00:00
|
|
|
--replace '"pytest-sanic",' "" \
|
2021-05-03 20:48:10 +00:00
|
|
|
# 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-06-28 23:13:55 +00:00
|
|
|
aiofiles
|
|
|
|
httptools
|
|
|
|
multidict
|
|
|
|
sanic-routing
|
|
|
|
ujson
|
|
|
|
uvloop
|
|
|
|
websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
beautifulsoup4
|
|
|
|
gunicorn
|
|
|
|
pytest-asyncio
|
|
|
|
pytest-benchmark
|
|
|
|
pytest-sugar
|
|
|
|
pytestCheckHook
|
|
|
|
sanic-testing
|
|
|
|
uvicorn
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
inherit doCheck;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
preCheck = ''
|
|
|
|
# Some tests depends on sanic on PATH
|
|
|
|
PATH="$out/bin:$PATH"
|
|
|
|
'';
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
disabledTests = [
|
2021-06-28 23:13:55 +00:00
|
|
|
# Tests are flaky
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_keep_alive_client_timeout"
|
2021-06-06 07:54:09 +00:00
|
|
|
"test_check_timeouts_request_timeout"
|
|
|
|
"test_check_timeouts_response_timeout"
|
2021-05-20 23:08:51 +00:00
|
|
|
"test_reloader_live"
|
2021-06-28 23:13:55 +00:00
|
|
|
"test_zero_downtime"
|
2021-12-06 16:07:01 +00:00
|
|
|
# Not working from 21.9.1
|
|
|
|
"test_create_server_main"
|
|
|
|
"test_create_server_main_convenience"
|
|
|
|
"test_debug"
|
|
|
|
"test_auto_reload"
|
|
|
|
"test_no_exceptions_when_cancel_pending_request"
|
|
|
|
"test_ipv6_address_is_not_wrapped"
|
2021-12-26 17:43:05 +00:00
|
|
|
# Failure of the redirect tests seems to be related to httpx>0.20.0
|
|
|
|
"test_redirect"
|
|
|
|
"test_chained_redirect"
|
|
|
|
"test_unix_connection"
|
2021-12-06 16:07:01 +00:00
|
|
|
# These appear to be very sensitive to output of commands
|
|
|
|
"test_access_logs"
|
|
|
|
"test_auto_reload"
|
|
|
|
"test_host_port"
|
|
|
|
"test_no_exceptions_when_cancel_pending_request"
|
|
|
|
"test_num_workers"
|
|
|
|
"test_server_run"
|
|
|
|
"test_version"
|
2020-12-09 12:39:15 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# avoid usage of nixpkgs-review in darwin since tests will compete usage
|
|
|
|
# for the same local port
|
2021-01-09 10:05:03 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"sanic"
|
|
|
|
];
|
2021-03-12 07:09:13 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2021-06-28 23:13:55 +00:00
|
|
|
description = "Web server and web framework";
|
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
|
|
|
};
|
|
|
|
}
|