Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 asgiref,
12 httpx,
13 inflection,
14 jsonschema,
15 jinja2,
16 python-multipart,
17 pyyaml,
18 requests,
19 starlette,
20 typing-extensions,
21 werkzeug,
22
23 # optional-dependencies
24 a2wsgi,
25 flask,
26 swagger-ui-bundle,
27 uvicorn,
28
29 # tests
30 pytest-aiohttp,
31 pytestCheckHook,
32 testfixtures,
33}:
34
35buildPythonPackage rec {
36 pname = "connexion";
37 version = "3.3.0";
38 pyproject = true;
39
40 src = fetchFromGitHub {
41 owner = "spec-first";
42 repo = "connexion";
43 tag = version;
44 hash = "sha256-mUnot9kdUgpxMXjKnkRzK9Dp2c7ibJzv4qX61ZPuJHM=";
45 };
46
47 build-system = [ poetry-core ];
48
49 dependencies = [
50 asgiref
51 httpx
52 inflection
53 jsonschema
54 jinja2
55 python-multipart
56 pyyaml
57 requests
58 starlette
59 typing-extensions
60 werkzeug
61 ];
62
63 optional-dependencies = {
64 flask = [
65 a2wsgi
66 flask
67 ];
68 swagger-ui = [ swagger-ui-bundle ];
69 uvicorn = [ uvicorn ];
70 };
71
72 nativeCheckInputs = [
73 pytest-aiohttp
74 pytestCheckHook
75 testfixtures
76 ]
77 ++ lib.concatAttrValues optional-dependencies;
78
79 pythonImportsCheck = [ "connexion" ];
80
81 disabledTests = [
82 "test_build_example"
83 "test_mock_resolver_no_example"
84 # Tests require network access
85 "test_remote_api"
86 ]
87 ++ lib.optionals stdenv.hostPlatform.isDarwin [
88 # ImportError: Error while finding loader for '/private/tmp/nix-build-python3.12-connexion-3.1.0.drv-0/source' (<class 'ModuleNotFoundError'>: No module named '/private/tmp/nix-build-python3')
89 "test_lifespan"
90 ];
91
92 meta = {
93 description = "Swagger/OpenAPI First framework on top of Flask";
94 homepage = "https://github.com/spec-first/connexion";
95 changelog = "https://github.com/spec-first/connexion/releases/tag/${version}";
96 license = lib.licenses.asl20;
97 maintainers = with lib.maintainers; [ bot-wxt1221 ];
98 mainProgram = "connexion";
99 };
100}