1{
2 lib,
3 anyio,
4 asgi-lifespan,
5 async-timeout,
6 buildPythonPackage,
7 fastapi,
8 fetchFromGitHub,
9 httpx,
10 portend,
11 psutil,
12 pytest-asyncio,
13 pytestCheckHook,
14 pythonOlder,
15 requests,
16 setuptools,
17 starlette,
18 tenacity,
19 testcontainers,
20 uvicorn,
21}:
22
23buildPythonPackage rec {
24 pname = "sse-starlette";
25 version = "2.3.5";
26 pyproject = true;
27
28 disabled = pythonOlder "3.9";
29
30 src = fetchFromGitHub {
31 owner = "sysid";
32 repo = "sse-starlette";
33 tag = "v${version}";
34 hash = "sha256-KTq8NwV4YhyfTLpsaF5jyrD3kyBcJ/xXtOwx4WvDFOo=";
35 };
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 anyio
41 starlette
42 ];
43
44 optional-dependencies = {
45 examples = [ fastapi ];
46 uvicorn = [ uvicorn ];
47 };
48
49 nativeCheckInputs = [
50 asgi-lifespan
51 async-timeout
52 fastapi
53 httpx
54 portend
55 psutil
56 pytest-asyncio
57 pytestCheckHook
58 requests
59 tenacity
60 testcontainers
61 uvicorn
62 ];
63
64 pythonImportsCheck = [ "sse_starlette" ];
65
66 disabledTests = [
67 # AssertionError
68 "test_stop_server_with_many_consumers"
69 "test_stop_server_conditional"
70 # require network access
71 "test_sse_multiple_consumers"
72 # require docker
73 "test_sse_server_termination"
74 ];
75
76 meta = with lib; {
77 description = "Server Sent Events for Starlette and FastAPI";
78 homepage = "https://github.com/sysid/sse-starlette";
79 changelog = "https://github.com/sysid/sse-starlette/blob/${src.tag}/CHANGELOG.md";
80 license = licenses.bsd3;
81 maintainers = with maintainers; [ fab ];
82 };
83}