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
|
2023-02-22 10:55:15 +00:00
|
|
|
, doCheck ? !stdenv.isDarwin # on Darwin, tests fail but pkg still works
|
2021-06-28 23:13:55 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, gunicorn
|
|
|
|
, httptools
|
|
|
|
, multidict
|
|
|
|
, pytest-asyncio
|
2023-02-22 10:55:15 +00:00
|
|
|
, pytestCheckHook
|
2021-12-26 17:43:05 +00:00
|
|
|
, pythonOlder
|
2022-03-10 19:12:11 +00:00
|
|
|
, pythonAtLeast
|
2021-06-28 23:13:55 +00:00
|
|
|
, sanic-routing
|
|
|
|
, sanic-testing
|
2023-01-20 10:41:00 +00:00
|
|
|
, setuptools
|
2021-06-28 23:13:55 +00:00
|
|
|
, ujson
|
|
|
|
, uvicorn
|
|
|
|
, uvloop
|
|
|
|
, websockets
|
2022-11-21 17:40:18 +00:00
|
|
|
, aioquic
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "sanic";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "22.12.0";
|
2023-01-20 10:41:00 +00:00
|
|
|
format = "pyproject";
|
2021-12-26 17:43:05 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
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;
|
2022-12-02 08:20:57 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-01-11 07:51:40 +00:00
|
|
|
hash = "sha256-Vj780rP5rJ+YsMWlb3BR9LTKT/nTt0C2H3J0X9sysj8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
aiofiles
|
2022-11-21 17:40:18 +00:00
|
|
|
aioquic
|
2021-06-28 23:13:55 +00:00
|
|
|
httptools
|
|
|
|
multidict
|
|
|
|
sanic-routing
|
|
|
|
ujson
|
|
|
|
uvloop
|
|
|
|
websockets
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-06-28 23:13:55 +00:00
|
|
|
beautifulsoup4
|
|
|
|
gunicorn
|
|
|
|
pytest-asyncio
|
|
|
|
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"
|
2022-02-10 20:34:41 +00:00
|
|
|
PYTHONPATH=$PWD:$PYTHONPATH
|
|
|
|
|
|
|
|
# needed for relative paths for some packages
|
|
|
|
cd tests
|
2023-02-22 10:55:15 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2022-05-18 14:49:53 +00:00
|
|
|
# OSError: [Errno 24] Too many open files
|
|
|
|
ulimit -n 1024
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
# uvloop usage is buggy
|
|
|
|
#SANIC_NO_UVLOOP = true;
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
"--asyncio-mode=auto"
|
2023-01-20 10:41:00 +00:00
|
|
|
"-vvv"
|
2022-02-10 20:34:41 +00:00
|
|
|
];
|
|
|
|
|
2020-12-09 12:39:15 +00:00
|
|
|
disabledTests = [
|
2022-11-21 17:40:18 +00:00
|
|
|
# Require networking
|
|
|
|
"test_full_message"
|
2023-01-20 10:41:00 +00:00
|
|
|
# Server mode mismatch (debug vs production)
|
2021-12-06 16:07:01 +00:00
|
|
|
"test_num_workers"
|
2022-06-16 17:23:12 +00:00
|
|
|
# Racy tests
|
|
|
|
"test_keep_alive_client_timeout"
|
|
|
|
"test_keep_alive_server_timeout"
|
|
|
|
"test_zero_downtime"
|
2023-01-20 10:41:00 +00:00
|
|
|
# sanic.exceptions.SanicException: Cannot setup Sanic Simple Server without a path to a directory
|
2022-12-02 08:20:57 +00:00
|
|
|
"test_load_app_simple"
|
2023-01-20 10:41:00 +00:00
|
|
|
# create defunct python processes
|
|
|
|
"test_reloader_live"
|
|
|
|
"test_reloader_live_with_dir"
|
|
|
|
"test_reload_listeners"
|
|
|
|
# crash the python interpreter
|
|
|
|
"test_host_port_localhost"
|
|
|
|
"test_host_port"
|
|
|
|
"test_server_run"
|
|
|
|
# NoneType object is not subscriptable
|
|
|
|
"test_serve_app_implicit"
|
|
|
|
# AssertionError: assert [] == ['Restarting a process', 'Begin restart termination', 'Starting a process']
|
|
|
|
"test_default_reload_shutdown_order"
|
|
|
|
# App not found.
|
|
|
|
"test_input_is_dir"
|
2020-12-09 12:39:15 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
disabledTestPaths = [
|
2022-06-16 17:23:12 +00:00
|
|
|
# We are not interested in benchmarks
|
|
|
|
"benchmark/"
|
2022-02-10 20:34:41 +00:00
|
|
|
# unable to create async loop
|
|
|
|
"test_app.py"
|
|
|
|
"test_asgi.py"
|
|
|
|
# occasionally hangs
|
|
|
|
"test_multiprocessing.py"
|
|
|
|
];
|
|
|
|
|
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;
|
|
|
|
|
2022-11-21 17:40:18 +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/";
|
2022-12-02 08:20:57 +00:00
|
|
|
changelog = "https://github.com/sanic-org/sanic/releases/tag/v${version}";
|
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
|
|
|
};
|
|
|
|
}
|