1{ buildPythonPackage
2, fetchFromGitHub
3, isPy3k
4, glibcLocales
5, lib
6, pythonOlder
7
8, aiohttp
9, aiohttp-swagger
10, aiohttp-jinja2
11, clickclick
12, decorator
13, flake8
14, flask
15, gevent
16, inflection
17, jsonschema
18, mock
19, openapi-spec-validator
20, pathlib
21, pytest
22, pytest-aiohttp
23, pytestcov
24, pyyaml
25, requests
26, six
27, swagger-ui-bundle
28, testfixtures
29, typing
30, ujson
31}:
32
33buildPythonPackage rec {
34 pname = "connexion";
35 version = "2.4.0";
36
37 # we're fetching from GitHub because tests weren't distributed on PyPi
38 src = fetchFromGitHub {
39 owner = "zalando";
40 repo = pname;
41 rev = version;
42 sha256 = "1b9q027wrks0afl7l3a1wxymz3aick26b9fq2m07pc5wb9np0vvg";
43 };
44
45 checkInputs = [
46 decorator
47 mock
48 pytest
49 pytestcov
50 testfixtures
51 flask
52 swagger-ui-bundle
53 ]
54 ++ lib.optionals isPy3k [ aiohttp aiohttp-jinja2 aiohttp-swagger ujson pytest-aiohttp ]
55 ++ lib.optional (pythonOlder "3.7") glibcLocales
56 ;
57 propagatedBuildInputs = [
58 clickclick
59 jsonschema
60 pyyaml
61 requests
62 six
63 inflection
64 openapi-spec-validator
65 swagger-ui-bundle
66 flask
67 ]
68 ++ lib.optional (pythonOlder "3.4") pathlib
69 ++ lib.optional (pythonOlder "3.6") typing
70 ++ lib.optionals isPy3k [ aiohttp aiohttp-jinja2 aiohttp-swagger ujson ]
71 ;
72
73 preConfigure = lib.optional (pythonOlder "3.7") ''
74 export LANG=en_US.UTF-8
75 '';
76
77 postPatch = ''
78 substituteInPlace setup.py --replace "'aiohttp>=2.3.10,<3.5.2'" "'aiohttp>=2.3.10'"
79 '';
80
81 checkPhase = if isPy3k then ''
82 pytest -k "not test_app_get_root_path and \
83 not test_verify_oauth_scopes_remote and \
84 not test_verify_oauth_scopes_local and \
85 not test_run_with_aiohttp_not_installed"''
86 else "pytest --ignore=tests/aiohttp";
87
88 meta = with lib; {
89 description = "Swagger/OpenAPI First framework on top of Flask";
90 homepage = "https://github.com/zalando/connexion/";
91 license = licenses.asl20;
92 maintainers = with maintainers; [ elohmeier ];
93 };
94}