1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 aioquic,
7 cacert,
8 h11,
9 h2,
10 httpx,
11 priority,
12 trio,
13 uvloop,
14 wsproto,
15 poetry-core,
16 pytest-asyncio,
17 pytest-trio,
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "hypercorn";
23 version = "0.17.3";
24 pyproject = true;
25
26 disabled = pythonOlder "3.11"; # missing taskgroup dependency
27
28 src = fetchFromGitHub {
29 owner = "pgjones";
30 repo = "Hypercorn";
31 tag = version;
32 hash = "sha256-AtSMURz1rOr6VTQ7L2EQ4XZeKVEGTPXTbs3u7IhnZo8";
33 };
34
35 postPatch = ''
36 sed -i "/^addopts/d" pyproject.toml
37 '';
38
39 build-system = [ poetry-core ];
40
41 dependencies = [
42 h11
43 h2
44 priority
45 wsproto
46 ];
47
48 optional-dependencies = {
49 h3 = [ aioquic ];
50 trio = [ trio ];
51 uvloop = [ uvloop ];
52 };
53
54 nativeCheckInputs = [
55 httpx
56 pytest-asyncio
57 pytest-trio
58 pytestCheckHook
59 ]
60 ++ lib.flatten (lib.attrValues optional-dependencies);
61
62 __darwinAllowLocalNetworking = true;
63
64 pythonImportsCheck = [ "hypercorn" ];
65
66 meta = with lib; {
67 changelog = "https://github.com/pgjones/hypercorn/blob/${src.tag}/CHANGELOG.rst";
68 homepage = "https://github.com/pgjones/hypercorn";
69 description = "ASGI web server inspired by Gunicorn";
70 mainProgram = "hypercorn";
71 license = licenses.mit;
72 maintainers = with maintainers; [ dgliwka ];
73 };
74}