forked from wemake-services/django-modern-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.importlinter
More file actions
166 lines (139 loc) · 3.37 KB
/
Copy path.importlinter
File metadata and controls
166 lines (139 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# See https://github.com/seddonym/import-linter
[importlinter]
root_package = dmr
include_external_packages = True
exclude_type_checking_imports = True
[importlinter:contract:layers]
name = Layered architecture of our project
type = layers
containers =
dmr
layers =
# Top level or so called "independent" modules:
problem_details
# Regular modules:
routing
controller
options_mixins
endpoint
validation
components
negotiation
response
plugins
serializer
openapi
headers | cookies
types
settings
exceptions
envs
ignore_imports =
# Mixin validation:
dmr.validation.* -> dmr.options_mixins
# Settings can clear cache:
dmr.settings -> dmr.internal.cache
# Settings can initialize default OpenAPI config:
dmr.settings -> dmr.openapi.config
# Schema loading can call pydantic plugin:
dmr.openapi.mappers.schema_normalization -> dmr.plugins.pydantic
[importlinter:contract:no-optional-deps]
name = Do not use these optional dependencies outside of plugins
type = forbidden
source_modules =
dmr
forbidden_modules =
# Optional deps:
pydantic
msgspec
jwt
allauth
openapi_spec_validator
polyfactory
yaml
attrs
attr
cattrs
# internal modules:
dmr_pytest
django_test_app
ignore_imports =
# Msgspec plugin:
dmr.plugins.msgspec -> msgspec
dmr.plugins.msgspec.* -> msgspec
# Pydantic plugin:
dmr.plugins.pydantic -> pydantic
dmr.plugins.pydantic.* -> pydantic
# Pydantic optional schema loading:
dmr.internal.dataclass_aliases -> pydantic
dmr.openapi.mappers.schema_normalization -> pydantic
# jwt auth:
dmr.security.jwt -> jwt
dmr.security.jwt.* -> jwt
# allauth headless auth:
dmr.security.allauth -> allauth
dmr.security.allauth.* -> allauth
# OpenAPI validation:
dmr.openapi.openapi -> openapi_spec_validator
# Examples generation:
dmr.openapi.mappers.example -> polyfactory
# Yaml:
dmr.openapi.views.yaml -> yaml
dmr.management.commands.dmr_export_schema -> yaml
# Optional json support from msgspec:
dmr.settings -> msgspec
dmr.internal.json -> msgspec
[importlinter:contract:plugins-independence]
name = All `plugins` must be independent
type = independence
modules =
dmr.plugins.*
[importlinter:contract:security-token-no-direct-model-import]
name = All `dmr.security.token` logic must be independent from the Token model
type = forbidden
source_modules =
dmr.security.token.auth
forbidden_modules =
dmr.security.token.app
[importlinter:streaming:layers]
name = Enforce correct layers in streaming
type = layers
containers =
dmr.streaming
layers =
sse | jsonl
controller
stream | renderer
metadata
validation
exceptions
[importlinter:openapi:layers]
name = Layered architecture of OpenAPI schema generation
type = layers
containers =
dmr.openapi
layers =
spec
views | core
generators
openapi
collector | config
objects
[importlinter:openapi:generators-independence]
name = All OpenAPI `generators` must be independent
type = independence
modules =
dmr.openapi.generators.*
[importlinter:openapi:objects-independence]
name = All OpenAPI `objects` must be independent
type = independence
modules =
dmr.openapi.objects.*
[importlinter:openapi:views-independence]
name = All OpenAPI `views` must be independent
type = independence
modules =
dmr.openapi.views.*
ignore_imports =
# Allow import base render class:
dmr.openapi.views.* -> dmr.openapi.views.base