1{
2 lib,
3 buildPythonPackage,
4 dj-rest-auth,
5 django,
6 django-allauth,
7 django-filter,
8 django-oauth-toolkit,
9 django-polymorphic,
10 django-rest-auth,
11 django-rest-polymorphic,
12 djangorestframework,
13 djangorestframework-camel-case,
14 djangorestframework-dataclasses,
15 djangorestframework-recursive,
16 djangorestframework-simplejwt,
17 drf-jwt,
18 drf-nested-routers,
19 drf-spectacular-sidecar,
20 fetchFromGitHub,
21 fetchpatch,
22 inflection,
23 jsonschema,
24 psycopg2,
25 pytest-django,
26 pytestCheckHook,
27 pythonOlder,
28 pyyaml,
29 setuptools,
30 uritemplate,
31}:
32
33buildPythonPackage rec {
34 pname = "drf-spectacular";
35 version = "0.28.0";
36 pyproject = true;
37
38 disabled = pythonOlder "3.7";
39
40 src = fetchFromGitHub {
41 owner = "tfranzel";
42 repo = "drf-spectacular";
43 tag = version;
44 hash = "sha256-+RXcCpsNAoGxK/taEf7+7QUDrHydvy5fIdBuEXi63DQ=";
45 };
46
47 patches = [
48 (fetchpatch {
49 # https://github.com/tfranzel/drf-spectacular/pull/1090
50 url = "https://github.com/tfranzel/drf-spectacular/commit/8db4c2458f8403c53db0db352dd94057d285814b.patch";
51 hash = "sha256-Ue5y7IB4ie+9CEineMBgMMCLGiF4zqmn60TJvKsV1h0=";
52 })
53 ];
54
55 postPatch = ''
56 substituteInPlace tests/conftest.py \
57 --replace-fail "'allauth.account'," "'allauth.account', 'allauth.socialaccount',"
58 '';
59
60 build-system = [ setuptools ];
61
62 dependencies = [
63 django
64 djangorestframework
65 inflection
66 jsonschema
67 pyyaml
68 uritemplate
69 ];
70
71 nativeCheckInputs = [
72 dj-rest-auth
73 django-allauth
74 django-filter
75 django-oauth-toolkit
76 django-polymorphic
77 django-rest-auth
78 django-rest-polymorphic
79 djangorestframework-camel-case
80 djangorestframework-dataclasses
81 djangorestframework-recursive
82 djangorestframework-simplejwt
83 drf-jwt
84 drf-nested-routers
85 drf-spectacular-sidecar
86 psycopg2
87 pytest-django
88 pytestCheckHook
89 ]
90 ++ django-allauth.optional-dependencies.socialaccount;
91
92 disabledTests = [
93 # Test requires django with gdal
94 "test_rest_framework_gis"
95 # Outdated test artifact
96 "test_callbacks"
97 # django-rest-knox is not packaged
98 "test_knox_auth_token"
99 # slightly different error messages which get asserted
100 "test_model_choice_display_method_on_readonly"
101 ];
102
103 disabledTestPaths = [
104 # Outdated test artifact
105 "tests/contrib/test_pydantic.py"
106 ];
107
108 pythonImportsCheck = [ "drf_spectacular" ];
109
110 optional-dependencies.sidecar = [ drf-spectacular-sidecar ];
111
112 meta = with lib; {
113 description = "Sane and flexible OpenAPI 3 schema generation for Django REST framework";
114 homepage = "https://github.com/tfranzel/drf-spectacular";
115 changelog = "https://github.com/tfranzel/drf-spectacular/releases/tag/${version}";
116 license = licenses.bsd3;
117 maintainers = [ ];
118 };
119}