summary refs log tree commit diff
path: root/pkgs/development/python-modules/sanic/default.nix
blob: 29b517ee56eb96baee431047ee89dfc057099ecc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ lib, buildPythonPackage, fetchPypi, doCheck ? true
, aiofiles, httptools, httpx, multidict, ujson, uvloop, websockets
, pytestCheckHook, beautifulsoup4, gunicorn, httpcore, uvicorn
, pytest-asyncio, pytest-benchmark, pytest-dependency, pytest-sanic, pytest-sugar, pytestcov
}:

buildPythonPackage rec {
  pname = "sanic";
  version = "20.9.1";

  src = fetchPypi {
    inherit pname version;
    sha256 = "06p0lsxqbfbka2yaqlpp0bg5pf7ma44zi6kq7qbb6hhry48dp1w6";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace '"multidict==5.0.0"' '"multidict"' \
      --replace '"httpx==0.15.4"' '"httpx"' \
      --replace '"httpcore==0.3.0"' '"httpcore"' \
      --replace '"pytest==5.2.1"' '"pytest"'
  '';

  propagatedBuildInputs = [
    aiofiles httptools httpx multidict ujson uvloop websockets
  ];

  checkInputs = [
    pytestCheckHook beautifulsoup4 gunicorn httpcore uvicorn
    pytest-asyncio pytest-benchmark pytest-dependency pytest-sanic pytest-sugar pytestcov
  ];

  inherit doCheck;

  disabledTests = [
    "test_gunicorn" # No "examples" directory in pypi distribution.
    "test_logo" # Fails to filter out "DEBUG asyncio:selector_events.py:59 Using selector: EpollSelector"
    "test_zero_downtime" # No "examples.delayed_response.app" module in pypi distribution.
    "test_reloader_live" # OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 42104)
  ];

  __darwinAllowLocalNetworking = true;

  pythonImportsCheck = [ "sanic" ];

  meta = with lib; {
    description = "A microframework based on uvloop, httptools, and learnings of flask";
    homepage = "https://github.com/channelcat/sanic/";
    license = licenses.mit;
    maintainers = [ maintainers.costrouc ];
  };
}