-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathpyproject.toml
More file actions
421 lines (395 loc) · 24.1 KB
/
pyproject.toml
File metadata and controls
421 lines (395 loc) · 24.1 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "openedx-platform"
version = "0.13"
requires-python = ">=3.11"
dependencies = ["setuptools"]
[tool.setuptools]
packages = ["cms", "common", "lms", "openedx", "xmodule"]
[tool.setuptools.package-data]
xmodule = ["js/module/*"]
[project.entry-points."xblock.v1"]
about = "xmodule.html_block:AboutBlock"
book = "xmodule.template_block:TranslateCustomTagBlock"
annotatable = "xmodule.annotatable_block:AnnotatableBlock"
chapter = "xmodule.seq_block:SectionBlock"
conditional = "xmodule.conditional_block:ConditionalBlock"
course = "xmodule.course_block:CourseBlock"
course_info = "xmodule.html_block:CourseInfoBlock"
customtag = "xmodule.template_block:CustomTagBlock"
custom_tag_template = "xmodule.template_block:CustomTagTemplateBlock"
discuss = "xmodule.template_block:TranslateCustomTagBlock"
discussion = "xmodule.discussion_block:DiscussionXBlock"
error = "xmodule.error_block:ErrorBlock"
hidden = "xmodule.hidden_block:HiddenBlock"
html = "xmodule.html_block:HtmlBlock"
itembank = "xmodule.item_bank_block:ItemBankBlock"
image = "xmodule.template_block:TranslateCustomTagBlock"
library = "xmodule.library_root_xblock:LibraryRoot"
library_content = "xmodule.library_content_block:LegacyLibraryContentBlock"
lti = "xmodule.lti_block:LTIBlock"
poll_question = "xmodule.poll_block:PollBlock"
problem = "xmodule.capa_block:ProblemBlock"
randomize = "xmodule.randomize_block:RandomizeBlock"
sequential = "xmodule.seq_block:SequenceBlock"
slides = "xmodule.template_block:TranslateCustomTagBlock"
split_test = "xmodule.split_test_block:SplitTestBlock"
static_tab = "xmodule.html_block:StaticTabBlock"
unit = "xmodule.unit_block:UnitBlock"
vertical = "xmodule.vertical_block:VerticalBlock"
video = "xmodule.video_block:VideoBlock"
videoalpha = "xmodule.video_block:VideoBlock"
videodev = "xmodule.template_block:TranslateCustomTagBlock"
word_cloud = "xmodule.word_cloud_block:WordCloudBlock"
wrapper = "xmodule.wrapper_block:WrapperBlock"
[project.entry-points."xblock_asides.v1"]
tagging_aside = "cms.lib.xblock.tagging:StructuredTagsAside"
[project.entry-points."openedx.course_tab"]
ccx = "lms.djangoapps.ccx.plugins:CcxCourseTab"
courseware = "lms.djangoapps.courseware.tabs:CoursewareTab"
dates = "lms.djangoapps.courseware.tabs:DatesTab"
discussion = "lms.djangoapps.discussion.plugins:DiscussionTab"
edxnotes = "lms.djangoapps.edxnotes.plugins:EdxNotesTab"
external_discussion = "lms.djangoapps.courseware.tabs:ExternalDiscussionCourseTab"
external_link = "lms.djangoapps.courseware.tabs:ExternalLinkCourseTab"
html_textbooks = "lms.djangoapps.courseware.tabs:HtmlTextbookTabs"
instructor = "lms.djangoapps.instructor.views.instructor_dashboard:InstructorDashboardTab"
lti_discussion = "openedx.features.lti_course_tab.tab:DiscussionLtiCourseTab"
lti_live = "openedx.core.djangoapps.course_live.tab:CourseLiveTab"
lti_tab = "openedx.features.lti_course_tab.tab:LtiCourseTab"
pdf_textbooks = "lms.djangoapps.courseware.tabs:PDFTextbookTabs"
progress = "lms.djangoapps.courseware.tabs:ProgressTab"
static_tab = "xmodule.tabs:StaticTab"
syllabus = "lms.djangoapps.courseware.tabs:SyllabusTab"
teams = "lms.djangoapps.teams.plugins:TeamsTab"
textbooks = "lms.djangoapps.courseware.tabs:TextbookTabs"
wiki = "lms.djangoapps.course_wiki.tab:WikiTab"
[project.entry-points."openedx.course_app"]
calculator = "lms.djangoapps.courseware.plugins:CalculatorCourseApp"
custom_pages = "lms.djangoapps.courseware.plugins:CustomPagesCourseApp"
dates = "lms.djangoapps.courseware.plugins:DatesCourseApp"
discussion = "openedx.core.djangoapps.discussions.plugins:DiscussionCourseApp"
edxnotes = "lms.djangoapps.edxnotes.plugins:EdxNotesCourseApp"
live = "openedx.core.djangoapps.course_live.plugins:LiveCourseApp"
ora_settings = "lms.djangoapps.courseware.plugins:ORASettingsApp"
proctoring = "lms.djangoapps.courseware.plugins:ProctoringCourseApp"
progress = "lms.djangoapps.courseware.plugins:ProgressCourseApp"
teams = "lms.djangoapps.teams.plugins:TeamsCourseApp"
textbooks = "lms.djangoapps.courseware.plugins:TextbooksCourseApp"
wiki = "lms.djangoapps.course_wiki.plugins.course_app:WikiCourseApp"
[project.entry-points."openedx.course_tool"]
calendar_sync_toggle = "openedx.features.calendar_sync.plugins:CalendarSyncToggleTool"
course_bookmarks = "openedx.features.course_bookmarks.plugins:CourseBookmarksTool"
course_updates = "openedx.features.course_experience.plugins:CourseUpdatesTool"
financial_assistance = "lms.djangoapps.courseware.course_tools:FinancialAssistanceTool"
[project.entry-points."lms.djangoapp"]
ace_common = "openedx.core.djangoapps.ace_common.apps:AceCommonConfig"
content_libraries = "openedx.core.djangoapps.content_libraries.apps:ContentLibrariesConfig"
course_apps = "openedx.core.djangoapps.course_apps.apps:CourseAppsConfig"
course_live = "openedx.core.djangoapps.course_live.apps:CourseLiveConfig"
courseware_api = "openedx.core.djangoapps.courseware_api.apps:CoursewareAPIConfig"
credentials = "openedx.core.djangoapps.credentials.apps:CredentialsConfig"
discussion = "lms.djangoapps.discussion.apps:DiscussionConfig"
discussions = "openedx.core.djangoapps.discussions.apps:DiscussionsConfig"
grades = "lms.djangoapps.grades.apps:GradesConfig"
plugins = "openedx.core.djangoapps.plugins.apps:PluginsConfig"
theming = "openedx.core.djangoapps.theming.apps:ThemingConfig"
bookmarks = "openedx.core.djangoapps.bookmarks.apps:BookmarksConfig"
zendesk_proxy = "openedx.core.djangoapps.zendesk_proxy.apps:ZendeskProxyConfig"
instructor = "lms.djangoapps.instructor.apps:InstructorConfig"
password_policy = "openedx.core.djangoapps.password_policy.apps:PasswordPolicyConfig"
user_authn = "openedx.core.djangoapps.user_authn.apps:UserAuthnConfig"
program_enrollments = "lms.djangoapps.program_enrollments.apps:ProgramEnrollmentsConfig"
[project.entry-points."cms.djangoapp"]
ace_common = "openedx.core.djangoapps.ace_common.apps:AceCommonConfig"
bookmarks = "openedx.core.djangoapps.bookmarks.apps:BookmarksConfig"
course_live = "openedx.core.djangoapps.course_live.apps:CourseLiveConfig"
content_libraries = "openedx.core.djangoapps.content_libraries.apps:ContentLibrariesConfig"
content_staging = "openedx.core.djangoapps.content_staging.apps:ContentStagingAppConfig"
course_apps = "openedx.core.djangoapps.course_apps.apps:CourseAppsConfig"
# Importing an LMS app into the Studio process is not a good practice.
# We're ignoring this for Discussions here because its placement in LMS
# is a historical artifact. The eventual goal is to consolidate the multiple
# discussions-related Django apps and either put them in the openedx/ dir,
# or in another repo entirely.
discussion = "lms.djangoapps.discussion.apps:DiscussionConfig"
discussions = "openedx.core.djangoapps.discussions.apps:DiscussionsConfig"
instructor = "lms.djangoapps.instructor.apps:InstructorConfig"
olx_rest_api = "openedx.core.djangoapps.olx_rest_api.apps:OlxRestApiAppConfig"
password_policy = "openedx.core.djangoapps.password_policy.apps:PasswordPolicyConfig"
plugins = "openedx.core.djangoapps.plugins.apps:PluginsConfig"
theming = "openedx.core.djangoapps.theming.apps:ThemingConfig"
user_authn = "openedx.core.djangoapps.user_authn.apps:UserAuthnConfig"
zendesk_proxy = "openedx.core.djangoapps.zendesk_proxy.apps:ZendeskProxyConfig"
[project.entry-points."openedx.block_structure_transformer"]
library_content = "lms.djangoapps.course_blocks.transformers.library_content:ContentLibraryTransformer"
library_content_randomize = "lms.djangoapps.course_blocks.transformers.library_content:ContentLibraryOrderTransformer"
split_test = "lms.djangoapps.course_blocks.transformers.split_test:SplitTestTransformer"
start_date = "lms.djangoapps.course_blocks.transformers.start_date:StartDateTransformer"
user_partitions = "lms.djangoapps.course_blocks.transformers.user_partitions:UserPartitionTransformer"
visibility = "lms.djangoapps.course_blocks.transformers.visibility:VisibilityTransformer"
hidden_content = "lms.djangoapps.course_blocks.transformers.hidden_content:HiddenContentTransformer"
course_blocks_api = "lms.djangoapps.course_api.blocks.transformers.blocks_api:BlocksAPITransformer"
milestones = "lms.djangoapps.course_api.blocks.transformers.milestones:MilestonesAndSpecialExamsTransformer"
grades = "lms.djangoapps.grades.transformer:GradesTransformer"
completion = "lms.djangoapps.course_api.blocks.transformers.block_completion:BlockCompletionTransformer"
load_override_data = "lms.djangoapps.course_blocks.transformers.load_override_data:OverrideDataTransformer"
content_type_gate = "openedx.features.content_type_gating.block_transformers:ContentTypeGateTransformer"
access_denied_message_filter = "lms.djangoapps.course_blocks.transformers.access_denied_filter:AccessDeniedMessageFilterTransformer"
open_assessment_transformer = "lms.djangoapps.courseware.transformers:OpenAssessmentDateTransformer"
effort_estimation = "openedx.features.effort_estimation.api:EffortEstimationTransformer"
discussions_link = "openedx.core.djangoapps.discussions.transformers:DiscussionsTopicLinkTransformer"
[project.entry-points."openedx.user_partition_scheme"]
cohort = "openedx.core.djangoapps.course_groups.partition_scheme:CohortPartitionScheme"
content_type_gate = "openedx.features.content_type_gating.partitions:ContentTypeGatingPartitionScheme"
enrollment_track = "openedx.core.djangoapps.verified_track_content.partition_scheme:EnrollmentTrackPartitionScheme"
random = "openedx.core.djangoapps.user_api.partition_schemes:RandomUserPartitionScheme"
team = "lms.djangoapps.teams.team_partition_scheme:TeamPartitionScheme"
verification = "openedx.core.djangoapps.user_api.partition_schemes:ReturnGroup1PartitionScheme"
[project.entry-points."openedx.ace.policy"]
bulk_email_optout = "lms.djangoapps.bulk_email.policies:CourseEmailOptout"
course_push_notification_optout = "openedx.core.djangoapps.notifications.policies:CoursePushNotificationOptout"
disabled_user_optout = "openedx.core.djangoapps.ace_common.policies:DisableUserOptout"
[project.entry-points."openedx.call_to_action"]
personalized_learner_schedules = "openedx.features.personalized_learner_schedules.call_to_action:PersonalizedLearnerScheduleCallToAction"
[project.entry-points."openedx.learning_context"]
lib = "openedx.core.djangoapps.content_libraries.library_context:LibraryContextImpl"
[project.entry-points."openedx.dynamic_partition_generator"]
content_type_gating = "openedx.features.content_type_gating.partitions:create_content_gating_partition"
enrollment_track = "xmodule.partitions.enrollment_track_partition_generator:create_enrollment_track_partition"
team = "openedx.core.lib.teams_config:create_team_set_partition"
[project.entry-points.console_scripts]
xmodule_assets = "xmodule.static_content:main"
[tool.pytest.ini_options]
# Note: The first file of settings found is used, there is no combining, so
# this file is only used for tests that don't find a pytest.ini file first.
# Details at https://docs.pytest.org/en/latest/reference/customize.html
DJANGO_SETTINGS_MODULE = "lms.envs.test"
addopts = "--nomigrations --reuse-db --durations=20 --json-report --json-report-omit keywords streams collectors log traceback tests --json-report-file=none"
# Enable default handling for all warnings, including those that are ignored by default;
# but hide rate-limit warnings (because we deliberately don't throttle test user logins)
# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring)
filterwarnings = [
"default",
"ignore:No request passed to the backend, unable to rate-limit:UserWarning",
"ignore::xblock.exceptions.FieldDataDeprecationWarning",
# Remove default_app_config warning after updating Django to 4.2
"ignore:.*You can remove default_app_config.*:PendingDeprecationWarning",
"ignore:Instead access HTTPResponse.headers directly.*:DeprecationWarning:elasticsearch",
# ABC deprecation Warning comes from libsass
"ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated.*:DeprecationWarning:sass",
"ignore:'etree' is deprecated. Use 'xml.etree.ElementTree' instead.:DeprecationWarning:wiki",
]
junit_family = "xunit2"
norecursedirs = ". .* *.egg build conf dist node_modules test_root cms/envs lms/envs openedx/envs"
python_classes = []
python_files = ["tests.py", "test_*.py", "tests_*.py", "*_tests.py", "__init__.py"]
[tool.ruff]
line-length = 120
exclude = [
"migrations",
"test_root/staticfiles",
]
[tool.ruff.lint]
select = ["E", "W"]
ignore = [
"E402", # module level import not at top of file
"E501", # line too long (pylint enforces this at 120 chars while ignoring trailing comments)
"E722", # do not use bare 'except'
"E731", # do not assign a lambda expression
"E741", # ambiguous variable name. TODO: fix the ~9 issues and re-enable this.
# The rules below were added in pycodestyle 2.9.x but we were pinned to 2.8.x,
# so they represent new findings. Keeping them ignored here to make this an
# equivalent swap; they can be cleaned up in a follow-up.
"E721", # use `isinstance()` for type comparisons
]
[tool.isort]
indent = " "
line_length = 120
multi_line_output = 3
skip = ["envs", "migrations"]
[tool.importlinter]
root_packages = ["lms", "cms", "openedx", "openedx_content", "openedx_catalog"]
include_external_packages = true
# Our custom contract which checks that we're only importing from 'api.py'
# for participating packages.
contract_types = [
"isolated_apps: openedx.testing.importlinter.isolated_apps_contract.IsolatedAppsContract",
]
[[tool.importlinter.contracts]]
name = "lms and cms are independent"
type = "independence"
modules = ["lms", "cms"]
ignore_imports = [
# lms side imports that we are ignoring for now
"lms.djangoapps.course_home_api.outline.tests.test_view -> cms.djangoapps.contentstore.outlines",
"lms.djangoapps.course_home_api.tests.utils -> cms.djangoapps.contentstore.outlines",
# lms.djangoapps.instructor.tests.test_api & lms.djangoapps.instructor.tests.test_tools
# -> openedx.core.djangoapps.course_date_signals.handlers
# -> cms.djangoapps.contentstore.config.waffle
"openedx.core.djangoapps.course_date_signals.handlers -> cms.djangoapps.contentstore.config.waffle",
# cms side imports that we are ignoring for now
"cms.djangoapps.contentstore.views.tests.test_block -> lms.djangoapps.lms_xblock.mixin",
"cms.djangoapps.contentstore.signals.handlers -> lms.djangoapps.grades.api",
"cms.djangoapps.contentstore.course_group_config -> lms.lib.utils",
"cms.djangoapps.contentstore.views.preview -> lms.djangoapps.lms_xblock.field_data",
# cms.envs.common
# -> openedx.envs.common
# -> lms.djangoapps.lms_xblock.mixin
"openedx.envs.common -> lms.djangoapps.lms_xblock.mixin",
# cms.djangoapps.contentstore.views.tests.test_group_configurations
# -> openedx.features.content_type_gating.helpers
# -> lms.djangoapps.courseware.masquerade
"openedx.features.content_type_gating.helpers -> lms.djangoapps.courseware.masquerade",
# cms.djangoapps.contentstore.utils
# -> openedx.core.djangoapps.django_comment_common.models
# -> openedx.core.djangoapps.course_groups.cohorts
# -> lms.djangoapps.courseware.courses
"openedx.core.djangoapps.course_groups.cohorts -> lms.djangoapps.courseware.courses",
# cms.djangoapps.contentstore.[various]
# -> openedx.features.content_type_gating.partitions
# -> lms.djangoapps.commerce.utils
"openedx.features.content_type_gating.partitions -> lms.djangoapps.commerce.utils",
# cms.djangoapps.contentstore.course_group_config
# -> openedx.core.djangoapps.course_groups.partition_scheme
# -> lms.djangoapps.courseware.masquerade
"openedx.core.djangoapps.course_groups.partition_scheme -> lms.djangoapps.courseware.masquerade",
# cms.djangoapps.export_course_metadata.tasks
# -> openedx.core.djangoapps.schedules.content_highlights
# -> lms.djangoapps.courseware.block_render & lms.djangoapps.courseware.model_data
"openedx.core.djangoapps.content_libraries.* -> lms.djangoapps.*.*",
# cms.djangoapps.contentstore.tasks -> openedx.core.djangoapps.content_libraries.[various]
# -> lms.djangoapps.grades.api
"openedx.core.djangoapps.xblock.*.* -> lms.djangoapps.*.*",
# cms.djangoapps.contentstore.tasks -> openedx.core.djangoapps.content_libraries.[various] -> openedx.core.djangoapps.xblock.[various]
# -> lms.djangoapps.courseware & lms.djangoapps.courseware.grades
"openedx.core.djangoapps.schedules.content_highlights -> lms.djangoapps.courseware.*",
# cms.djangoapps.contentstore.[various]
# -> openedx.core.lib.gating.api
# -> lms.djangoapps.course_blocks.api & lms.djangoapps.courseware.access & lms.djangoapps.grades.api
"openedx.core.lib.gating.api -> lms.djangoapps.*.*",
# cms.djangoapps.contentstore.[various]
# -> openedx.features.content_type_gating.partitions
# -> openedx.features.discounts.utils
# -> lms.djangoapps.courseware.utils & lms.djangoapps.experiments.models
"openedx.features.discounts.utils -> lms.djangoapps.courseware.utils",
"openedx.features.discounts.utils -> lms.djangoapps.experiments.models",
# cms.djangoapps.contentstore.signals.handlers
# -> openedx.core.djangoapps.discussions.tasks
# -> openedx.core.djangoapps.discussions.utils
# -> lms.djangoapps.courseware.access
"openedx.core.djangoapps.discussions.utils -> lms.djangoapps.courseware.access",
# cms.djangoapps.contentstore.[various]
# -> openedx.features.content_type_gating.partitions
# -> openedx.features.discounts.utils
# -> openedx.features.discounts.applicability
# -> lms.djangoapps.courseware.toggles
# & lms.djangoapps.courseware.utils
# & lms.djangoapps.experiments.models
# & lms.djangoapps.experiments.stable_bucketing
"openedx.features.discounts.applicability -> lms.djangoapps.courseware.*",
"openedx.features.discounts.applicability -> lms.djangoapps.experiments.*",
# cms.djangoapps.contentstore.[various]
# -> openedx.core.djangoapps.content.learning_sequences.api
# -> openedx.core.djangoapps.content.learning_sequences.api.outlines
# -> openedx.core.djangoapps.content.learning_sequences.api.permissions
# -> lms.djangoapps.courseware.access
"openedx.core.djangoapps.content.learning_sequences.api.permissions -> lms.djangoapps.courseware.access",
# cms.djangoapps.contentstore.[various]
# -> openedx.features.content_type_gating.partitions
# -> openedx.features.discounts.utils
# -> openedx.features.discounts.applicability
# -> openedx.features.enterprise_support.utils
"openedx.features.enterprise_support.utils -> lms.djangoapps.branding.api",
"cms.djangoapps.contentstore.rest_api.v1.views.settings -> lms.djangoapps.certificates.api",
# We are ignoring this existing import until we can refactor contenstore/helpers.
# https://github.com/openedx/edx-platform/issues/37637
"openedx.core.djangoapps.content_libraries.api.libraries -> cms.djangoapps.contentstore.helpers",
"openedx.core.djangoapps.content_libraries.api.blocks -> cms.djangoapps.contentstore.helpers",
"openedx.core.djangoapps.content_staging.serializers -> cms.djangoapps.contentstore.helpers",
# These imports will become OK once we move content_libraries into CMS
# https://github.com/openedx/edx-platform/issues/33428
"openedx.core.djangoapps.content_libraries.permissions -> cms.djangoapps.course_creators.views",
"openedx.core.djangoapps.content_libraries.tasks -> cms.djangoapps.contentstore.storage",
# Outstanding arch issue: course_overviews is tangled up with LMS
# https://github.com/openedx/edx-platform/issues/37658
"openedx.core.djangoapps.content.course_overviews.models -> lms.djangoapps.**",
# Outstanding arch issue: content_highlights uses courseware block_render
# https://github.com/openedx/edx-platform/issues/37659
"openedx.core.djangoapps.schedules.content_highlights -> lms.djangoapps.courseware.block_render",
]
[[tool.importlinter.contracts]]
name = "Do not depend on non-public API of isolated apps."
type = "isolated_apps"
isolated_apps = [
"cms.djangoapps.modulestore_migrator",
"openedx.core.djangoapps.agreements",
"openedx.core.djangoapps.bookmarks",
"openedx.core.djangoapps.content_libraries",
"openedx.core.djangoapps.content_staging",
"openedx.core.djangoapps.olx_rest_api",
"openedx.core.djangoapps.xblock",
"openedx.core.lib.xblock_serializer",
"openedx_catalog",
]
allowed_modules = [
# Only imports from api.py and data.py are allowed elsewhere in the code
# See https://open-edx-proposals.readthedocs.io/en/latest/best-practices/oep-0049-django-app-patterns.html#api-py
"api",
"models_api",
"data",
"tests",
]
[[tool.importlinter.contracts]]
name = "Do not directly import internals of openedx_content (only import from openedx_content.api)."
type = "forbidden"
source_modules = ["cms", "lms", "openedx", "common", "xmodule"]
forbidden_modules = ["openedx_content.applets", "openedx_content.backcompat"]
allow_indirect_imports = true
[[tool.importlinter.contracts]]
name = "Low-level apps should not depend on high-level apps"
type = "layers"
layers = [
# Layers from high-level to low-level. Imports should only occur from higher to lower.
"cms.lib.xblock.upstream_sync | openedx.core.djangoapps.content.search | openedx.core.djangoapps.olx_rest_api",
"openedx.core.djangoapps.content_libraries",
"openedx.core.djangoapps.content_staging",
"openedx.core.djangoapps.xblock",
"openedx.core.lib.xblock_serializer",
"openedx.core.djangoapps.content_tagging",
]
ignore_imports = [
# Test code can break these layering rules
"**.tests.** -> **",
# FIXME: the exceptions below are from before we added this import linting rule. Should refactor to eliminate them.
# In particular, the contentstore.helpers module is too big and has too many imports
# See https://github.com/openedx/edx-platform/issues/37637
# The CSV export hard-codes support for courses and libraries. Refactor to do something like learning_context.get_children()
"openedx.core.djangoapps.content_tagging.helpers.objecttag_export_helpers -> openedx.core.djangoapps.content_libraries.api",
# The permissions checking code for tagging requires libraries model data to get all the orgs that a user is using:
"openedx.core.djangoapps.content_tagging.utils -> openedx.core.djangoapps.content_libraries.api",
# Content staging POST to clipboard API uses libraries APIs. We're working on moving this code to content_libraries
"openedx.core.djangoapps.content_staging.views -> openedx.core.djangoapps.content_libraries.api",
# content_staging.serializers imports contentstore.helpers which imports contentstore.utils which imports the libraries API.
"openedx.core.djangoapps.content_staging.serializers -> cms.djangoapps.contentstore.helpers",
# content_libraries.rest_api.libraries imports cms.djangoapps.contentstore.views.course which imports
# contentstore.toggles which imports djangoapps.content.search.api
"openedx.core.djangoapps.content_libraries.rest_api.libraries -> cms.djangoapps.contentstore.views.course",
# Content libraries imports contentstore.helpers which imports upstream_sync
"openedx.core.djangoapps.content_libraries.api.blocks -> cms.djangoapps.contentstore.helpers",
"openedx.core.djangoapps.content_libraries.api.libraries -> cms.djangoapps.contentstore.helpers",
# Outstanding arch issue: course_overviews is tangled up with LMS
# https://github.com/openedx/edx-platform/issues/37658
"openedx.core.djangoapps.content.course_overviews.models -> lms.djangoapps.**",
# Outstanding arch issue: content_highlights uses courseware block_render
# https://github.com/openedx/edx-platform/issues/37659
"openedx.core.djangoapps.schedules.content_highlights -> lms.djangoapps.courseware.block_render",
# This import happens only because grading signals are defined in LMS rather than openedx-events
# https://github.com/openedx/edx-platform/issues/37660
"openedx.core.djangoapps.xblock.runtime.runtime -> lms.djangoapps.grades.api",
# These imports will become OK once we worked on the following issue:
# https://github.com/openedx/edx-platform/issues/33428
"openedx.core.djangoapps.video_config.services -> openedx.core.djangoapps.content_libraries.api",
]