1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 chardet,
7 click,
8 flex,
9 packaging,
10 pyicu,
11 requests,
12 ruamel-yaml,
13 setuptools-scm,
14 six,
15 swagger-spec-validator,
16 pytestCheckHook,
17 openapi-spec-validator,
18}:
19
20buildPythonPackage rec {
21 pname = "prance";
22 version = "23.06.21.0";
23 format = "pyproject";
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 owner = "RonnyPfannschmidt";
29 repo = pname;
30 rev = "v${version}";
31 fetchSubmodules = true;
32 hash = "sha256-p+LZbQal4DPeMp+eJ2O83rCaL+QIUDcU34pZhYdN4bE=";
33 };
34
35 postPatch = ''
36 substituteInPlace setup.cfg \
37 --replace "--cov=prance --cov-report=term-missing --cov-fail-under=90" ""
38 '';
39
40 nativeBuildInputs = [ setuptools-scm ];
41
42 propagatedBuildInputs = [
43 chardet
44 packaging
45 requests
46 ruamel-yaml
47 six
48 ];
49
50 passthru.optional-dependencies = {
51 cli = [ click ];
52 flex = [ flex ];
53 icu = [ pyicu ];
54 osv = [ openapi-spec-validator ];
55 ssv = [ swagger-spec-validator ];
56 };
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
61
62 # Disable tests that require network
63 disabledTestPaths = [ "tests/test_convert.py" ];
64 disabledTests = [
65 "test_convert_defaults"
66 "test_convert_output"
67 "test_fetch_url_http"
68 "test_openapi_spec_validator_validate_failure"
69 ];
70 pythonImportsCheck = [ "prance" ];
71
72 meta = with lib; {
73 changelog = "https://github.com/RonnyPfannschmidt/prance/blob/${src.rev}/CHANGES.rst";
74 description = "Resolving Swagger/OpenAPI 2.0 and 3.0.0 Parser";
75 mainProgram = "prance";
76 homepage = "https://github.com/RonnyPfannschmidt/prance";
77 license = licenses.mit;
78 maintainers = [ ];
79 };
80}