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