about summary refs log tree commit diff
path: root/pkgs/development/python-modules/daphne/default.nix
blob: 1cb0a1998493ed0f4d9ab4fc1b3aa2fc1dd4af80 (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
53
54
55
56
57
58
59
60
61
{ lib
, stdenv
, asgiref
, autobahn
, buildPythonPackage
, django
, fetchFromGitHub
, hypothesis
, pytest-asyncio
, pytestCheckHook
, pythonOlder
, twisted
}:

buildPythonPackage rec {
  pname = "daphne";
  version = "4.0.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "django";
    repo = pname;
    rev = version;
    hash = "sha256-vPMrmC2B0Pcvk8Y1FsJ4PXnzIMtPod7lL2u0IYNVUxc=";
  };

  propagatedBuildInputs = [
    asgiref
    autobahn
    twisted
  ] ++ twisted.optional-dependencies.tls;

  nativeCheckInputs = [
    django
    hypothesis
    pytest-asyncio
    pytestCheckHook
  ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace "pytest-runner" ""
  '';

  # Most tests fail on darwin
  doCheck = !stdenv.isDarwin;

  pythonImportsCheck = [
    "daphne"
  ];

  meta = with lib; {
    description = "Django ASGI (HTTP/WebSocket) server";
    mainProgram = "daphne";
    homepage = "https://github.com/django/daphne";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}