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 setuptools,
14 twisted,
15}:
16
17buildPythonPackage rec {
18 pname = "daphne";
19 version = "4.1.2";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchFromGitHub {
25 owner = "django";
26 repo = "daphne";
27 rev = "refs/tags/${version}";
28 hash = "sha256-RAK2CaKKVmVIv1MBK+9xyADOrHq664MQOry4KaGTNCw=";
29 };
30
31 postPatch = ''
32 substituteInPlace setup.cfg \
33 --replace-fail "pytest-runner" ""
34 '';
35
36 build-system = [ setuptools ];
37
38 dependencies = [
39 asgiref
40 autobahn
41 twisted
42 ] ++ twisted.optional-dependencies.tls;
43
44 nativeCheckInputs = [
45 django
46 hypothesis
47 pytest-asyncio
48 pytestCheckHook
49 ];
50
51 # Most tests fail on darwin
52 doCheck = !stdenv.isDarwin;
53
54 pythonImportsCheck = [ "daphne" ];
55
56 meta = with lib; {
57 description = "Django ASGI (HTTP/WebSocket) server";
58 homepage = "https://github.com/django/daphne";
59 changelog = "https://github.com/django/daphne/blob/${version}/CHANGELOG.txt";
60 license = licenses.bsd3;
61 maintainers = [ ];
62 mainProgram = "daphne";
63 };
64}