Skip to content

Commit 5750147

Browse files
docs: mark all containers APIs as unstable
1 parent 275d5d0 commit 5750147

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

openedx_learning/apps/authoring/containers/api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from ..publishing import api as publishing_api
2323

2424

25+
# 🛑 UNSTABLE: All APIs related to containers are unstable until we've figured
26+
# out our approach to dynamic content (randomized, A/B tests, etc.)
2527
__all__ = [
2628
"create_container",
2729
"create_container_version",
@@ -42,6 +44,7 @@ def create_container(
4244
created_by: int | None,
4345
) -> ContainerEntity:
4446
"""
47+
[ 🛑 UNSTABLE ]
4548
Create a new container.
4649
4750
Args:
@@ -65,6 +68,7 @@ def create_container(
6568

6669
def create_entity_list() -> EntityList:
6770
"""
71+
[ 🛑 UNSTABLE ]
6872
Create a new entity list. This is an structure that holds a list of entities
6973
that will be referenced by the container.
7074
@@ -81,6 +85,7 @@ def create_next_defined_list(
8185
entity_version_pks: list[int | None],
8286
) -> EntityListRow:
8387
"""
88+
[ 🛑 UNSTABLE ]
8489
Create new entity list rows for an entity list.
8590
8691
Args:
@@ -129,6 +134,7 @@ def create_defined_list_with_rows(
129134
entity_version_pks: list[int | None],
130135
) -> EntityList:
131136
"""
137+
[ 🛑 UNSTABLE ]
132138
Create new entity list rows for an entity list.
133139
134140
Args:
@@ -164,6 +170,7 @@ def get_entity_list_with_pinned_versions(
164170
rows: QuerySet[EntityListRow],
165171
) -> EntityList:
166172
"""
173+
[ 🛑 UNSTABLE ]
167174
Copy rows from an existing entity list to a new entity list.
168175
169176
Args:
@@ -194,6 +201,7 @@ def check_unpinned_versions_in_defined_list(
194201
defined_list: EntityList,
195202
) -> bool:
196203
"""
204+
[ 🛑 UNSTABLE ]
197205
Check if there are any unpinned versions in the defined list.
198206
199207
Args:
@@ -214,6 +222,7 @@ def check_new_changes_in_defined_list(
214222
publishable_entities_pk: list[int],
215223
) -> bool:
216224
"""
225+
[ 🛑 UNSTABLE ]
217226
Check if there are any new changes in the defined list.
218227
219228
Args:
@@ -239,6 +248,7 @@ def create_container_version(
239248
created_by: int | None,
240249
) -> ContainerEntityVersion:
241250
"""
251+
[ 🛑 UNSTABLE ]
242252
Create a new container version.
243253
244254
Args:
@@ -288,6 +298,7 @@ def create_next_container_version(
288298
created_by: int | None,
289299
) -> ContainerEntityVersion:
290300
"""
301+
[ 🛑 UNSTABLE ]
291302
Create the next version of a container. A new version of the container is created
292303
only when its metadata changes:
293304
@@ -378,6 +389,7 @@ def create_container_and_version(
378389
entity_version_pks: list[int | None],
379390
) -> ContainerEntityVersion:
380391
"""
392+
[ 🛑 UNSTABLE ]
381393
Create a new container and its first version.
382394
383395
Args:
@@ -409,6 +421,7 @@ def create_container_and_version(
409421

410422
def get_container(pk: int) -> ContainerEntity:
411423
"""
424+
[ 🛑 UNSTABLE ]
412425
Get a container by its primary key.
413426
414427
Args:
@@ -424,6 +437,7 @@ def get_container(pk: int) -> ContainerEntity:
424437
@dataclass(frozen=True)
425438
class ContainerEntityListEntry:
426439
"""
440+
[ 🛑 UNSTABLE ]
427441
Data about a single entity in a container, e.g. a component in a unit.
428442
"""
429443
entity_version: PublishableEntityVersion
@@ -438,6 +452,7 @@ def get_entities_in_draft_container(
438452
container: ContainerEntity | ContainerEntityMixin,
439453
) -> list[ContainerEntityListEntry]:
440454
"""
455+
[ 🛑 UNSTABLE ]
441456
Get the list of entities and their versions in the draft version of the
442457
given container.
443458
"""
@@ -458,6 +473,7 @@ def get_entities_in_published_container(
458473
container: ContainerEntity | ContainerEntityMixin,
459474
) -> list[ContainerEntityListEntry] | None:
460475
"""
476+
[ 🛑 UNSTABLE ]
461477
Get the list of entities and their versions in the draft version of the
462478
given container.
463479
"""
@@ -486,6 +502,7 @@ def contains_unpublished_changes(
486502
container: ContainerEntity | ContainerEntityMixin,
487503
) -> bool:
488504
"""
505+
[ 🛑 UNSTABLE ]
489506
Check recursively if a container has any unpublished changes.
490507
491508
Note: container.versioning.has_unpublished_changes only checks if the container

openedx_learning/apps/authoring/units/api.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
from datetime import datetime
1818

19+
# 🛑 UNSTABLE: All APIs related to containers are unstable until we've figured
20+
# out our approach to dynamic content (randomized, A/B tests, etc.)
1921
__all__ = [
2022
"create_unit",
2123
"create_unit_version",
@@ -33,7 +35,8 @@
3335
def create_unit(
3436
learning_package_id: int, key: str, created: datetime, created_by: int | None
3537
) -> Unit:
36-
"""Create a new unit.
38+
"""
39+
[ 🛑 UNSTABLE ] Create a new unit.
3740
3841
Args:
3942
learning_package_id: The learning package ID.
@@ -61,7 +64,8 @@ def create_unit_version(
6164
created: datetime,
6265
created_by: int | None = None,
6366
) -> Unit:
64-
"""Create a new unit version.
67+
"""
68+
[ 🛑 UNSTABLE ] Create a new unit version.
6569
6670
Args:
6771
unit_pk: The unit ID.
@@ -98,7 +102,8 @@ def create_next_unit_version(
98102
created: datetime,
99103
created_by: int | None = None,
100104
) -> Unit:
101-
"""Create the next unit version.
105+
"""
106+
[ 🛑 UNSTABLE ] Create the next unit version.
102107
103108
Args:
104109
unit_pk: The unit ID.
@@ -145,7 +150,8 @@ def create_unit_and_version(
145150
created: datetime,
146151
created_by: int | None = None,
147152
) -> tuple[Unit, UnitVersion]:
148-
"""Create a new unit and its version.
153+
"""
154+
[ 🛑 UNSTABLE ] Create a new unit and its version.
149155
150156
Args:
151157
learning_package_id: The learning package ID.
@@ -168,7 +174,8 @@ def create_unit_and_version(
168174

169175

170176
def get_unit(unit_pk: int) -> Unit:
171-
"""Get a unit.
177+
"""
178+
[ 🛑 UNSTABLE ] Get a unit.
172179
173180
Args:
174181
unit_pk: The unit ID.
@@ -177,7 +184,8 @@ def get_unit(unit_pk: int) -> Unit:
177184

178185

179186
def get_unit_version(unit_version_pk: int) -> UnitVersion:
180-
"""Get a unit version.
187+
"""
188+
[ 🛑 UNSTABLE ] Get a unit version.
181189
182190
Args:
183191
unit_version_pk: The unit version ID.
@@ -186,7 +194,8 @@ def get_unit_version(unit_version_pk: int) -> UnitVersion:
186194

187195

188196
def get_latest_unit_version(unit_pk: int) -> UnitVersion:
189-
"""Get the latest unit version.
197+
"""
198+
[ 🛑 UNSTABLE ] Get the latest unit version.
190199
191200
Args:
192201
unit_pk: The unit ID.
@@ -197,6 +206,7 @@ def get_latest_unit_version(unit_pk: int) -> UnitVersion:
197206
@dataclass(frozen=True)
198207
class UnitListEntry:
199208
"""
209+
[ 🛑 UNSTABLE ]
200210
Data about a single entity in a container, e.g. a component in a unit.
201211
"""
202212
component_version: ComponentVersion
@@ -211,6 +221,7 @@ def get_components_in_draft_unit(
211221
unit: Unit,
212222
) -> list[UnitListEntry]:
213223
"""
224+
[ 🛑 UNSTABLE ]
214225
Get the list of entities and their versions in the draft version of the
215226
given container.
216227
"""
@@ -228,6 +239,7 @@ def get_components_in_published_unit(
228239
unit: Unit | UnitVersion,
229240
) -> list[UnitListEntry]:
230241
"""
242+
[ 🛑 UNSTABLE ]
231243
Get the list of entities and their versions in the draft version of the
232244
given container.
233245
"""

tests/openedx_learning/apps/authoring/units/test_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,19 @@ def test_query_count_of_contains_unpublished_changes(self):
305305
with self.assertNumQueries(2):
306306
assert authoring_api.contains_unpublished_changes(unit) == True
307307

308+
# Test that soft-deleting a component doesn't show the unit as changed but does show it contains changes ?
308309
# Test that only components can be added to units
309310
# Test that components must be in the same learning package
310311
# Test that _version_pks=[] arguments must be related to publishable_entities_pks
311-
# Test that publishing a unit publishes its child components (either automatically or throws an exception if you
312-
# don't request the children be published together with the containeer)
312+
# Test that publishing a unit publishes its child components automatically
313313
# Test that publishing a component does NOT publish changes to its parent unit
314314
# Test that I can get a history of a given unit and all its children, including children that aren't currently in
315315
# the unit and excluding children that are only in other units.
316316
# Test that I can get a history of a given unit and its children, that includes changes made to the child components
317317
# while they were part of the unit but excludes changes made to those children while they were not part of
318318
# the unit. 🫣
319-
# Test viewing old snapshots of units and components by passing in a timestamp to some get_historic_unit() API?
319+
# Test viewing old snapshots of units and components by passing in a timestamp (or PublishLog PK) to a
320+
# get_historic_unit() API?
320321

321322

322323
def test_next_version_with_different_different_title(self):

0 commit comments

Comments
 (0)