build!: Switch to openedx-core (renamed from openedx-learning) (#38011)
build!: Switch to openedx-core (renamed from openedx-learning) Instead of installing openedx-learning==0.32.0, we install openedx-core==0.34.1. We update various class names, function names, docstrings, and comments to represent the rename: * We say "openedx-core" when referring to the whole repo or PyPI project * or occasionally "Open edX Core" if we want it to look nice in the docs. * We say "openedx_content" to refer to the Content API within openedx-core, which is actually the thing we have been calling "Learning Core" all along. * In snake-case code, it's `*_openedx_content_*`. * In camel-case code, it's `*OpenedXContent*` For consistency's sake we avoid anything else like oex_core, OeXCore, OpenEdXCore, OexContent, openedx-content, OpenEdxContent, etc. There should be no more references to learning_core, learning-core, Learning Core, Learning-Core, LC, openedx-learning, openedx_learning, etc. BREAKING CHANGE: for openedx-learning/openedx-core developers: You may need to uninstall openedx-learning and re-install openedx-core from your venv. If running tutor, you may need to un-mount openedx-learning, rename the directory to openedx-core, re-mount it, and re-build. The code APIs themselves are fully backwards-compatible. Part of: https://github.com/openedx/openedx-core/issues/470
This commit is contained in:
@@ -614,7 +614,7 @@ def get_unit_tags(usage_key):
|
||||
Get the tags of a Unit and build a json to be read by the UI
|
||||
|
||||
Note: When migrating the `TagList` subview from `container_subview.js` to the course-authoring MFE,
|
||||
this function can be simplified to use the REST API of openedx-learning,
|
||||
this function can be simplified to use the REST API of openedx_tagging,
|
||||
which already provides this grouping + sorting logic.
|
||||
"""
|
||||
# Get content tags from content tagging API
|
||||
|
||||
@@ -91,18 +91,18 @@ def link_video_to_component(video_component, user):
|
||||
return edx_video_id
|
||||
|
||||
|
||||
def save_video_transcript_in_learning_core(
|
||||
def save_video_transcript_in_openedx_content(
|
||||
usage_key,
|
||||
input_format,
|
||||
transcript_content,
|
||||
language_code
|
||||
):
|
||||
"""
|
||||
Saves a video transcript to the learning core.
|
||||
Saves a video transcript with the openedx_content API.
|
||||
|
||||
Learning Core uses the standard `.srt` format for subtitles.
|
||||
openedx_content uses the standard `.srt` format for subtitles.
|
||||
Note: SJSON is an edx-specific format that we're trying to move away from,
|
||||
so for all new stuff related to Learning Core should only use `.srt`.
|
||||
so for all new stuff related to openedx_content should only use `.srt`.
|
||||
|
||||
Arguments:
|
||||
usage_key: UsageKey of the block
|
||||
@@ -615,7 +615,7 @@ def choose_transcripts(request):
|
||||
|
||||
# 3. Upload the retrieved transcript to DS for the linked video ID.
|
||||
if isinstance(video.usage_key.context_key, LibraryLocatorV2):
|
||||
success = save_video_transcript_in_learning_core(
|
||||
success = save_video_transcript_in_openedx_content(
|
||||
video.usage_key,
|
||||
input_format,
|
||||
transcript_content,
|
||||
@@ -669,7 +669,7 @@ def rename_transcripts(request):
|
||||
|
||||
# 3. Upload the retrieved transcript to DS for the linked video ID.
|
||||
if isinstance(video.usage_key.context_key, LibraryLocatorV2):
|
||||
success = save_video_transcript_in_learning_core(
|
||||
success = save_video_transcript_in_openedx_content(
|
||||
video.usage_key,
|
||||
input_format,
|
||||
transcript_content,
|
||||
@@ -725,7 +725,7 @@ def replace_transcripts(request):
|
||||
for transcript in transcript_content:
|
||||
[language_code, json_content] = transcript
|
||||
if isinstance(video.usage_key.context_key, LibraryLocatorV2):
|
||||
success = save_video_transcript_in_learning_core(
|
||||
success = save_video_transcript_in_openedx_content(
|
||||
video.usage_key,
|
||||
Transcript.SJSON,
|
||||
json_content,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
A nice little admin interface for migrating courses and libraries from modulstore to Learning Core.
|
||||
A nice little admin interface for migrating courses and libraries from modulstore to openedx_content.
|
||||
"""
|
||||
import logging
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ __all__ = (
|
||||
|
||||
def get_forwarding_for_blocks(source_keys: t.Iterable[UsageKey]) -> dict[UsageKey, ModulestoreBlockMigrationSuccess]:
|
||||
"""
|
||||
Authoritatively determine how some Modulestore blocks have been migrated to Learning Core.
|
||||
Authoritatively determine how some Modulestore blocks have been migrated to openedx_content.
|
||||
|
||||
Returns a mapping from source usage keys to block migration data objects. Each block migration object
|
||||
holds the target usage key and title. If a source key is missing from the mapping, then it has not
|
||||
@@ -79,7 +79,7 @@ def get_forwarding_for_blocks(source_keys: t.Iterable[UsageKey]) -> dict[UsageKe
|
||||
|
||||
def is_forwarded(source_key: SourceContextKey) -> bool:
|
||||
"""
|
||||
Has this course or legacy library been authoratively migrated to Learning Core,
|
||||
Has this course or legacy library been authoratively migrated to openedx_content,
|
||||
such that references to the source course/library should be forwarded to the target library?
|
||||
"""
|
||||
return get_forwarding(source_key) is not None
|
||||
@@ -87,7 +87,7 @@ def is_forwarded(source_key: SourceContextKey) -> bool:
|
||||
|
||||
def get_forwarding(source_key: SourceContextKey) -> ModulestoreMigration | None:
|
||||
"""
|
||||
Authoritatively determine how some Modulestore course or legacy library has been migrated to Learning Core.
|
||||
Authoritatively determine how some Modulestore course or legacy library has been migrated to openedx_content.
|
||||
|
||||
If no such successful migration exists, returns None.
|
||||
|
||||
@@ -123,7 +123,7 @@ def get_migrations(
|
||||
is_failed: bool | None = None,
|
||||
) -> t.Generator[ModulestoreMigration]:
|
||||
"""
|
||||
Given some criteria, get all modulestore->LearningCore migrations.
|
||||
Given some criteria, get all modulestore->openedx_content migrations.
|
||||
|
||||
Returns an iterable, ordered from NEWEST to OLDEST.
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ SourceContextKey: t.TypeAlias = CourseLocator | LibraryLocator
|
||||
@dataclass(frozen=True)
|
||||
class ModulestoreMigration:
|
||||
"""
|
||||
Metadata on a migration of a course or legacy library to a v2 library in learning core.
|
||||
Metadata on a migration of a course or legacy library to a v2 library in openedx_content.
|
||||
"""
|
||||
pk: int
|
||||
source_key: SourceContextKey
|
||||
@@ -107,7 +107,7 @@ class ModulestoreMigration:
|
||||
@dataclass(frozen=True)
|
||||
class ModulestoreBlockMigrationResult:
|
||||
"""
|
||||
Base class for a modulestore block that was part of an attempted migration to learning core.
|
||||
Base class for a modulestore block that was part of an attempted migration to openedx_content.
|
||||
"""
|
||||
source_key: UsageKey
|
||||
is_failed: t.ClassVar[bool]
|
||||
@@ -116,7 +116,7 @@ class ModulestoreBlockMigrationResult:
|
||||
@dataclass(frozen=True)
|
||||
class ModulestoreBlockMigrationSuccess(ModulestoreBlockMigrationResult):
|
||||
"""
|
||||
Info on a modulestore block which has been successfully migrated into an LC entity
|
||||
Info on a modulestore block which has been successfully migrated to an openedx_content entity
|
||||
"""
|
||||
target_entity_pk: int
|
||||
target_key: LibraryUsageLocatorV2 | LibraryContainerLocator
|
||||
@@ -128,7 +128,7 @@ class ModulestoreBlockMigrationSuccess(ModulestoreBlockMigrationResult):
|
||||
@dataclass(frozen=True)
|
||||
class ModulestoreBlockMigrationFailure(ModulestoreBlockMigrationResult):
|
||||
"""
|
||||
Info on a modulestore block which failed to be migrated into LC
|
||||
Info on a modulestore block which failed to be migrated into openedx_content
|
||||
"""
|
||||
unsupported_reason: str
|
||||
is_failed: t.ClassVar[bool] = True
|
||||
|
||||
@@ -68,7 +68,7 @@ class ModulestoreSource(models.Model):
|
||||
class ModulestoreMigration(models.Model):
|
||||
"""
|
||||
Tracks the action of a user importing a Modulestore-based course or legacy library into a
|
||||
learning-core based learning package
|
||||
openedx_content based learning package
|
||||
|
||||
Notes:
|
||||
* As of Ulmo, a learning package is always associated with a v2 content library, but we
|
||||
|
||||
@@ -75,7 +75,7 @@ _error_responses = {
|
||||
)
|
||||
class MigrationViewSet(StatusViewSet):
|
||||
"""
|
||||
JSON HTTP API to create and check on ModuleStore-to-Learning-Core migration tasks.
|
||||
JSON HTTP API to create and check on ModuleStore-to-openedx_content migration tasks.
|
||||
"""
|
||||
|
||||
authentication_classes = (
|
||||
@@ -257,7 +257,7 @@ class MigrationViewSet(StatusViewSet):
|
||||
|
||||
class BulkMigrationViewSet(StatusViewSet):
|
||||
"""
|
||||
JSON HTTP API to bulk-create ModuleStore-to-Learning-Core migration tasks.
|
||||
JSON HTTP API to bulk-create ModuleStore-to-openedx_content migration tasks.
|
||||
"""
|
||||
|
||||
authentication_classes = (
|
||||
|
||||
@@ -61,7 +61,7 @@ log = get_task_logger(__name__)
|
||||
|
||||
class MigrationStep(Enum):
|
||||
"""
|
||||
Strings representation the state of an in-progress modulestore-to-learning-core import.
|
||||
Strings representation the state of an in-progress modulestore-to-openedx_content import.
|
||||
|
||||
We use these values to set UserTaskStatus.state.
|
||||
The other possible UserTaskStatus.state values are the built-in ones:
|
||||
@@ -313,16 +313,16 @@ def _import_structure(
|
||||
status: UserTaskStatus,
|
||||
) -> tuple[t.Any, _MigratedNode]:
|
||||
"""
|
||||
Import the staged content structure into the target Learning Core library.
|
||||
Import the staged content structure into the target openedx_content library.
|
||||
|
||||
Args:
|
||||
migration (ModulestoreMigration):
|
||||
The migration record representing the ongoing modulestore-to-learning-core migration.
|
||||
The migration record representing the ongoing modulestore-to-openedx_content migration.
|
||||
source_data (_MigrationSourceData):
|
||||
Data extracted from the legacy modulestore, including the source root usage key.
|
||||
Use `_validate_input()` to generate this data.
|
||||
target_library (libraries_api.ContentLibraryMetadata):
|
||||
The target library where the new Learning Core content will be created.
|
||||
The target library where the new openedx_content content will be created.
|
||||
content_by_filename (dict[str, int]):
|
||||
A mapping between OLX file names and their associated file IDs in the staging area.
|
||||
Use `_import_assets` to generate this content.
|
||||
@@ -338,7 +338,7 @@ def _import_structure(
|
||||
`content_api.bulk_draft_changes_for`, containing all the imported changes.
|
||||
- The second element (`root_migrated_node`): a `_MigratedNode` object that
|
||||
represents the mapping between the legacy root node and its newly created
|
||||
Learning Core equivalent.
|
||||
openedx_content equivalent.
|
||||
"""
|
||||
migration = source_data.migration
|
||||
migration_context = _MigrationContext(
|
||||
|
||||
Reference in New Issue
Block a user