1{
2 lib,
3 stdenv,
4 asgiref,
5 autobahn,
6 buildPythonPackage,
7 django,
8 fetchFromGitHub,
9 hypothesis,
10 pytest-asyncio,
11 pytestCheckHook,
12 pythonOlder,
13 twisted,
14}:
15
16buildPythonPackage rec {
17 pname = "daphne";
18 version = "4.0.0";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "django";
25 repo = pname;
26 rev = version;
27 hash = "sha256-vPMrmC2B0Pcvk8Y1FsJ4PXnzIMtPod7lL2u0IYNVUxc=";
28 };
29
30 propagatedBuildInputs = [
31 asgiref
32 autobahn
33 twisted
34 ] ++ twisted.optional-dependencies.tls;
35
36 nativeCheckInputs = [
37 django
38 hypothesis
39 pytest-asyncio
40 pytestCheckHook
41 ];
42
43 postPatch = ''
44 substituteInPlace setup.py \
45 --replace "pytest-runner" ""
46 '';
47
48 # Most tests fail on darwin
49 doCheck = !stdenv.isDarwin;
50
51 pythonImportsCheck = [ "daphne" ];
52
53 meta = with lib; {
54 description = "Django ASGI (HTTP/WebSocket) server";
55 mainProgram = "daphne";
56 homepage = "https://github.com/django/daphne";
57 license = licenses.bsd3;
58 maintainers = with maintainers; [ ];
59 };
60}