1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 pythonOlder,
7
8 # build-system
9 poetry-core,
10
11 # dependencies
12 asgiref,
13 httpx,
14 inflection,
15 jsonschema,
16 jinja2,
17 python-multipart,
18 pyyaml,
19 requests,
20 starlette,
21 typing-extensions,
22 werkzeug,
23
24 # optional-dependencies
25 a2wsgi,
26 flask,
27 swagger-ui-bundle,
28 uvicorn,
29
30 # tests
31 pytest-aiohttp,
32 pytestCheckHook,
33 testfixtures,
34}:
35
36buildPythonPackage rec {
37 pname = "connexion";
38 version = "3.1.0";
39 pyproject = true;
40
41 disabled = pythonOlder "3.8";
42
43 src = fetchFromGitHub {
44 owner = "spec-first";
45 repo = "connexion";
46 rev = "refs/tags/${version}";
47 hash = "sha256-rngQDU9kXw/Z+Al0SCVnWN8xnphueTtZ0+xPBR5MbEM=";
48 };
49
50 patches = [
51 # A really small Part of https://github.com/spec-first/connexion/pull/1992 Will fix check on newest dependencies
52 ./0001-Part-of-1992.patch
53 ];
54
55 build-system = [ poetry-core ];
56
57 dependencies = [
58 asgiref
59 httpx
60 inflection
61 jsonschema
62 jinja2
63 python-multipart
64 pyyaml
65 requests
66 starlette
67 typing-extensions
68 werkzeug
69 ];
70
71 optional-dependencies = {
72 flask = [
73 a2wsgi
74 flask
75 ];
76 swagger-ui = [ swagger-ui-bundle ];
77 uvicorn = [ uvicorn ];
78 };
79
80 nativeCheckInputs = [
81 pytest-aiohttp
82 pytestCheckHook
83 testfixtures
84 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
85
86 pythonImportsCheck = [ "connexion" ];
87
88 disabledTests =
89 [
90 "test_build_example"
91 "test_mock_resolver_no_example"
92 # Tests require network access
93 "test_remote_api"
94 # AssertionError
95 "test_headers"
96 # waiter.acquire() deadlock
97 "test_cors_server_error"
98 "test_get_bad_default_response"
99 "test_schema_response"
100 "test_writeonly"
101 ]
102 ++ lib.optionals stdenv.hostPlatform.isDarwin [
103 # 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')
104 "test_lifespan"
105 ];
106
107 meta = {
108 description = "Swagger/OpenAPI First framework on top of Flask";
109 homepage = "https://github.com/spec-first/connexion";
110 changelog = "https://github.com/spec-first/connexion/releases/tag/${version}";
111 license = lib.licenses.asl20;
112 maintainers = with lib.maintainers; [ bot-wxt1221 ];
113 mainProgram = "connexion";
114 };
115}