1{
2 lib,
3 buildPythonPackage,
4 pythonAtLeast,
5 pythonOlder,
6 isPyPy,
7 fetchFromGitHub,
8
9 # build
10 cython,
11 setuptools,
12
13 # tests
14 aiofiles,
15 cbor2,
16 httpx,
17 msgpack,
18 mujson,
19 orjson,
20 pytest7CheckHook,
21 pyyaml,
22 rapidjson,
23 requests,
24 testtools,
25 ujson,
26 uvicorn,
27 websockets,
28}:
29
30buildPythonPackage rec {
31 pname = "falcon";
32 version = "4.0.2";
33 pyproject = true;
34
35 disabled = pythonOlder "3.5";
36
37 src = fetchFromGitHub {
38 owner = "falconry";
39 repo = "falcon";
40 tag = version;
41 hash = "sha256-umNuHyZrdDGyrhQEG9+f08D4Wwrz6bVJ6ysw8pfbHv4=";
42 };
43
44 build-system = [ setuptools ] ++ lib.optionals (!isPyPy) [ cython ];
45
46 __darwinAllowLocalNetworking = true;
47
48 preCheck = ''
49 export HOME=$TMPDIR
50 cp -R tests examples $TMPDIR
51 pushd $TMPDIR
52 '';
53
54 postCheck = ''
55 popd
56 '';
57
58 nativeCheckInputs = [
59 # https://github.com/falconry/falcon/blob/master/requirements/tests
60 pytest7CheckHook
61 pyyaml
62 requests
63 rapidjson
64 orjson
65
66 # ASGI specific
67 aiofiles
68 httpx
69 uvicorn
70 websockets
71
72 # handler specific
73 cbor2
74 msgpack
75 mujson
76 ujson
77 ]
78 ++ lib.optionals (pythonOlder "3.10") [ testtools ];
79
80 enabledTestPaths = [ "tests" ];
81
82 disabledTestPaths = [
83 # needs a running server
84 "tests/asgi/test_asgi_servers.py"
85 ]
86 ++ lib.optionals (pythonAtLeast "3.12") [
87 # ModuleNotFoundError: No module named 'distutils'
88 "tests/asgi/test_cythonized_asgi.py"
89 ];
90
91 meta = with lib; {
92 changelog = "https://falcon.readthedocs.io/en/stable/changes/${version}.html";
93 description = "Ultra-reliable, fast ASGI+WSGI framework for building data plane APIs at scale";
94 homepage = "https://falconframework.org/";
95 license = licenses.asl20;
96 };
97}