diff --git a/.coveragerc b/.coveragerc index fb2ddbfe5..8ec3f2fae 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,8 +2,7 @@ branch = True data_file = .coverage source = - openedx_learning - openedx_tagging + src omit = test_settings **/migrations/* diff --git a/.github/workflows/lint-imports.yml b/.github/workflows/lint-imports.yml index 93a3c3ea2..6a2b638bd 100644 --- a/.github/workflows/lint-imports.yml +++ b/.github/workflows/lint-imports.yml @@ -17,13 +17,13 @@ jobs: - name: setup python uses: actions/setup-python@v6 with: - python-version: '3.11' + python-version: '3.12' - name: Install pip run: pip install -r requirements/pip.txt - name: Install Dependencies - run: pip install -r requirements/ci.txt + run: pip install -e . -r requirements/quality.txt - name: Analyze imports run: lint-imports diff --git a/.gitignore b/.gitignore index faa881b9a..ea7591535 100644 --- a/.gitignore +++ b/.gitignore @@ -54,8 +54,8 @@ output/*/index.html # Sphinx docs/_build docs/modules.rst -docs/openedx_learning.rst -docs/openedx_learning.*.rst +docs/openedx_content.rst +docs/openedx_content.*.rst # Private requirements requirements/private.in @@ -66,6 +66,7 @@ dev.db* # virtualenv venv/ +.venv/ ### Visual Studio Code ### # Generally ignore VS Code configuration, except... diff --git a/.importlinter b/.importlinter index 8125927ba..1525e25d6 100644 --- a/.importlinter +++ b/.importlinter @@ -1,59 +1,73 @@ -# openedx_learning is intended to be a library of apps used across multiple +# This repo is intended to be a library of apps used across multiple # projects, and we want to ensure certain dependency relationships. Please # think through any changes you make to this file carefully, and don't just # casually modify these linting rules to "fix the build". + [importlinter] -root_package = openedx_learning - -# This is the most basic layering for openedx_learning. -# -# The "lib" package is meant for low level utilities, field definitions, and the -# like, so it's at the bottom layer. -# -# The "core" apps are meant to be the heart of our system, with foundational -# data models and plugin interfaces. It can rely on "lib" utilities. -# -# The "contrib" apps are meant to be apps that could easily be created outside -# of openedx_learning in a separate repository, but are bundled here because -# we think they'll be generally useful. These apps may call into "core" or "lib" -# apps, but not the other way around. The "core" apps should *never* import from -# "contrib". -[importlinter:contract:openedx_learning_layering] -name = Lib / Core / Contrib Layering -type = layers -layers= - openedx_learning.contrib - openedx_learning.apps - openedx_learning.lib +root_packages = + openedx_tagging + openedx_content + openedx_core + openedx_django_lib + +[importlinter:contract:core_does_not_use_anything] +name = "openedx_core does not import anything (it's just a version number)" +type = forbidden +source_modules= + openedx_core +forbidden_modules= + openedx_tagging + openedx_content + openedx_django_lib -# This is layering within our Authoring apps. Every new app should be added to +[importlinter:contract:django_lib_does_not_use_anything] +name = "openedx_django_lib does not depend on any other part of the repo" +type = forbidden +source_modules= + openedx_django_lib +forbidden_modules= + openedx_tagging + openedx_content + openedx_core + +[importlinter:contract:tagging_and_content_independent] +name = "openedx_tagging and openedx_content are independent" +type = independence +modules= + openedx_tagging + openedx_content + +# This is layering within our Content applets. Every new applet should be added to # this list when it it created. -[importlinter:contract:core_apps_layering] -name = Authoring App Dependency Layering +[importlinter:contract:content_applet_layering] +name = "openedx_content's internal applets are layered correctly" type = layers layers= - # The public authoring API is at the top–none of the apps should call to it. - openedx_learning.api.authoring + # The public API is at the top–none of the apps should call to it. + openedx_content.api + + # The "media_server" should not be depended upon by anything else + openedx_content.applets.media_server # The "backup_restore" app handle the new export and import mechanism. - openedx_learning.apps.openedx_content.applets.backup_restore + openedx_content.applets.backup_restore # The "components" app is responsible for storing versioned Components, # which is Open edX Studio terminology maps to things like individual # Problems, Videos, and blocks of HTML text. This is also the type we would # associate with a single "leaf" XBlock–one that is not a container type and # has no child elements. - openedx_learning.apps.openedx_content.applets.components + openedx_content.applets.components # The "contents" app stores the simplest pieces of binary and text data, # without versioning information. These belong to a single Learning Package. - openedx_learning.apps.openedx_content.applets.contents + openedx_content.applets.contents # The "collections" app stores arbitrary groupings of PublishableEntities. # Its only dependency should be the publishing app. - openedx_learning.apps.openedx_content.applets.collections + openedx_content.applets.collections # The lowest layer is "publishing", which holds the basic primitives needed # to create Learning Packages and manage the draft and publish states for # various types of content. - openedx_learning.apps.openedx_content.applets.publishing + openedx_content.applets.publishing diff --git a/MANIFEST.in b/MANIFEST.in index 73b8b7ee4..1d20f64af 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,4 @@ include CHANGELOG.rst include LICENSE.txt include README.rst include requirements/base.in -recursive-include openedx_learning *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py -recursive-include openedx_tagging *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py *.yaml *.json *.csv +recursive-include src *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py diff --git a/Makefile b/Makefile index 5bf7f276a..16380a393 100644 --- a/Makefile +++ b/Makefile @@ -83,18 +83,14 @@ selfcheck: ## check that the Makefile is well-formed extract_translations: ## extract strings to be translated, outputting .mo files rm -rf docs/_build - cd openedx_learning && ../manage.py makemessages -l en -v1 -d django - cd openedx_learning && ../manage.py makemessages -l en -v1 -d djangojs - cd openedx_tagging && ../manage.py makemessages -l en -v1 -d django - cd openedx_tagging && ../manage.py makemessages -l en -v1 -d djangojs + ./manage.py makemessages -l en -v1 -d django + ./manage.py makemessages -l en -v1 -d djangojs compile_translations: ## compile translation files, outputting .po files for each supported language - cd openedx_learning && ../manage.py compilemessages - cd openedx_tagging && ../manage.py compilemessages + ./manage.py compilemessages detect_changed_source_translations: - cd openedx_learning && i18n_tool changed - cd openedx_tagging && i18n_tool changed + cd src && i18n_tool changed pull_translations: ## pull translations from Transifex tx pull -a -f -t --mode reviewed @@ -103,8 +99,7 @@ push_translations: ## push source translation files (.po) from Transifex tx push -s dummy_translations: ## generate dummy translation (.po) files - cd openedx_learning && i18n_tool dummy - cd openedx_tagging && i18n_tool dummy + cd src && i18n_tool dummy build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files diff --git a/README.rst b/README.rst index b2be0c147..5d375f9b9 100644 --- a/README.rst +++ b/README.rst @@ -7,29 +7,22 @@ Open edX Learning Core (and Tagging) Overview -------- -The ``openedx_learning`` package holds Django apps that represent core learning concepts and data models that have been extracted from edx-platform. At the moment, this repo also contains the ``openedx_tagging`` package, but this will likely be moved out in the future. +The ``openedx-learning`` project holds Django apps that represent core learning platform concepts. Motivation ---------- -The short term goal of this project is to create a small, extensible core that is easier to reason about and write extensions for than edx-platform. The longer term goal is to create a more nimble core learning platform, enabling rapid experimentation and drastic changes to the learner experience that are difficult to implement with Open edX today. +The short term goal of this project is to create a small, extensible core that is easier to reason about and write extensions for than openedx-platform. The longer term goal is to create a more nimble core learning platform, enabling rapid experimentation and drastic changes to the learner experience that are difficult to implement with Open edX today. -Replacing edx-platform is explicitly *not* a goal of this project, as only a small fraction of the concepts in edx-platform make sense to carry over here. When these core concepts are extracted and the data migrated, edx-platform will import apps from this repo and make use of their public in-process APIs. +Replacing openedx-platform is explicitly *not* a goal of this project, as only a small fraction of the concepts in openedx-platform make sense to carry over here. When these core concepts are extracted and the data migrated, openedx-platform will import apps from this repo and make use of their public in-process APIs. Architecture ------------ -Parts -~~~~~ - -* ``openedx_learning.lib`` is for shared utilities, and may include things like custom field types, plugin registration code, etc. -* ``openedx_learning.apps`` contains our Learning Core Django apps, where foundational data structures and APIs will live. The first of these is ``authoring``, which holds apps related to the editing and publishing of learning content. -* ``openedx_tagging.core`` contains the core Tagging app, which provides data structures and apis for tagging Open edX objects. - Learning Core Package Dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Learning Core code should never import from ``edx-platform``. +Learning Core code should never import from ``openedx-platform``. We want to be very strict about dependency management internally as well. Please read the `.importlinter config file <.importlinter>`_ file and the `Python API Conventions ADR `_ for more details. @@ -56,7 +49,7 @@ The structure of this repo follows [OEP-0049](https://open-edx-proposals.readthe Code Overview ------------- -The ``openedx_learning.apps`` package contains all our Django applications. +The ``src`` folder contains all our Django applications. Development Workflow -------------------- diff --git a/docs/conf.py b/docs/conf.py index 8d5e0f62f..98a61ba92 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -35,7 +35,7 @@ def get_version(*file_paths): REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(REPO_ROOT) -VERSION = get_version('../openedx_learning', '__init__.py') +VERSION = get_version('src/openedx_core', '__init__.py') # Configure Django for autodoc usage os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings' diff --git a/mypy.ini b/mypy.ini index b97332862..a13257a17 100644 --- a/mypy.ini +++ b/mypy.ini @@ -6,8 +6,7 @@ plugins = mypy_django_plugin.main, mypy_drf_plugin.main files = - openedx_learning, - openedx_tagging, + src, tests [mypy.plugins.django-stubs] diff --git a/mysql_test_settings.py b/mysql_test_settings.py index b72e58ab0..ee58fe11e 100644 --- a/mysql_test_settings.py +++ b/mysql_test_settings.py @@ -17,7 +17,7 @@ -p 3306:3306 mysql:8 """ -from test_settings import * +from test_settings import * # pylint: disable=wildcard-import DATABASES = { "default": { diff --git a/olx_importer/management/commands/load_components.py b/olx_importer/management/commands/load_components.py index f0d3ede4e..832812b3b 100644 --- a/olx_importer/management/commands/load_components.py +++ b/olx_importer/management/commands/load_components.py @@ -28,9 +28,7 @@ from django.db import transaction # Model references to remove -from openedx_learning.apps.openedx_content.applets.components import api as components_api -from openedx_learning.apps.openedx_content.applets.contents import api as contents_api -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api +from openedx_content import api as content_api SUPPORTED_TYPES = ["problem", "video", "html"] logger = logging.getLogger(__name__) @@ -81,20 +79,20 @@ def load_course_data(self, learning_package_key): now = datetime.now(timezone.utc) title = self.get_course_title() - if publishing_api.learning_package_exists(learning_package_key): + if content_api.learning_package_exists(learning_package_key): raise CommandError( f"{learning_package_key} already exists. " "This command currently only supports initial import." ) with transaction.atomic(): - self.learning_package = publishing_api.create_learning_package( + self.learning_package = content_api.create_learning_package( learning_package_key, title, created=now, ) for block_type in SUPPORTED_TYPES: self.import_block_type(block_type, now) #, publish_log_entry) - publishing_api.publish_all_drafts( + content_api.publish_all_drafts( self.learning_package.id, message="Initial Import from load_components script" ) @@ -116,13 +114,13 @@ def create_content(self, static_local_path, now, component_version): logger.warning(f' Static reference not found: "{real_path}"') return # Might as well bail if we can't find the file. - content = contents_api.get_or_create_file_content( + content = content_api.get_or_create_file_content( self.learning_package.id, data=data_bytes, mime_type=mime_type, created=now, ) - components_api.create_component_version_content( + content_api.create_component_version_content( component_version, content.id, key=key, @@ -138,7 +136,7 @@ def import_block_type(self, block_type_name, now): # , publish_log_entry): # outside of tag declarations as well. static_files_regex = re.compile(r"""['"]\/static\/(.+?)["'\?]""") block_data_path = self.course_data_path / block_type_name - block_type = components_api.get_or_create_component_type("xblock.v1", block_type_name) + block_type = content_api.get_or_create_component_type("xblock.v1", block_type_name) for xml_file_path in block_data_path.glob("*.xml"): components_found += 1 @@ -154,7 +152,7 @@ def import_block_type(self, block_type_name, now): # , publish_log_entry): continue display_name = block_root.attrib.get("display_name", "") - _component, component_version = components_api.create_component_and_version( + _component, component_version = content_api.create_component_and_version( self.learning_package.id, component_type=block_type, local_key=local_key, @@ -165,14 +163,14 @@ def import_block_type(self, block_type_name, now): # , publish_log_entry): # Create the Content entry for the raw data... text = xml_file_path.read_text('utf-8') - text_content, _created = contents_api.get_or_create_text_content( + text_content, _created = content_api.get_or_create_text_content( self.learning_package.id, text=text, mime_type=f"application/vnd.openedx.xblock.v1.{block_type_name}+xml", created=now, ) # Add the OLX source text to the ComponentVersion - components_api.create_component_version_content( + content_api.create_component_version_content( component_version, text_content.pk, key="block.xml", diff --git a/openedx_learning/__init__.py b/openedx_learning/__init__.py deleted file mode 100644 index 4457588a2..000000000 --- a/openedx_learning/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -Open edX Learning ("Learning Core"). -""" - -__version__ = "0.31.0" diff --git a/openedx_learning/api/authoring.py b/openedx_learning/api/authoring.py deleted file mode 100644 index 5b1334ab4..000000000 --- a/openedx_learning/api/authoring.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -This is the public API for content authoring in Learning Core. - -This is the single ``api`` module that code outside of the -``openedx_learning.apps.openedx_content.*`` package should import from. It will -re-export the public functions from all api.py modules of all authoring apps. It -may also implement its own convenience APIs that wrap calls to multiple app -APIs. -""" -# These wildcard imports are okay because these api modules declare __all__. -# pylint: disable=wildcard-import -from ..apps.openedx_content.api import * - -# This was renamed after the authoring API refactoring pushed this and other -# app APIs into the openedx_learning.api.authoring module. Here I'm aliasing to -# it's previous name, to make migration a little easier. -create_next_version = create_next_component_version diff --git a/openedx_learning/api/django.py b/openedx_learning/api/django.py deleted file mode 100644 index 267d0e038..000000000 --- a/openedx_learning/api/django.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -Module for parts of the Learning Core API that exist to make it easier to use in -Django projects. -""" - - -def openedx_learning_apps_to_install(): - """ - Return all app names for appending to INSTALLED_APPS. - - This function exists to better insulate edx-platform and potential plugins - over time, as we eventually plan to remove the backcompat apps. - """ - return [ - "openedx_learning.apps.openedx_content", - "openedx_learning.apps.openedx_content.backcompat.backup_restore", - "openedx_learning.apps.openedx_content.backcompat.collections", - "openedx_learning.apps.openedx_content.backcompat.components", - "openedx_learning.apps.openedx_content.backcompat.contents", - "openedx_learning.apps.openedx_content.backcompat.publishing", - "openedx_learning.apps.openedx_content.backcompat.sections", - "openedx_learning.apps.openedx_content.backcompat.subsections", - "openedx_learning.apps.openedx_content.backcompat.units", - ] diff --git a/openedx_learning/apps/openedx_content/api.py b/openedx_learning/apps/openedx_content/api.py deleted file mode 100644 index 082b369e2..000000000 --- a/openedx_learning/apps/openedx_content/api.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This module aggregates all applet API modules. - -Question: Should this replace openedx_learning.api.authoring? -""" - -# pylint: disable=wildcard-import - -from .applets.backup_restore.api import * -from .applets.collections.api import * -from .applets.components.api import * -from .applets.contents.api import * -from .applets.publishing.api import * -from .applets.sections.api import * -from .applets.subsections.api import * -from .applets.units.api import * diff --git a/openedx_learning/contrib/readme.rst b/openedx_learning/contrib/readme.rst deleted file mode 100644 index 908ed6217..000000000 --- a/openedx_learning/contrib/readme.rst +++ /dev/null @@ -1,9 +0,0 @@ -Contrib Package -=============== - -The ``contrib`` package holds Django apps that *could* be implemented in separate repos, but are bundled here because it's more convenient to do so. - -Guidelines ----------- - -Nothing from ``lib`` or ``core`` should *ever* import from ``contrib``. diff --git a/openedx_learning/lib/cache.py b/openedx_learning/lib/cache.py deleted file mode 100644 index 098dbab01..000000000 --- a/openedx_learning/lib/cache.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Test-friendly helpers for caching. - -LRU caching can be especially helpful for Learning Core data models because so -much of it is immutable, e.g. Media Type lookups. But while these data models -are immutable within a given site, we also want to be able to track and clear -these caches across test runs. Later on, we may also want to inspect them to -make sure they are not growing overly large. -""" -import functools - -# List of functions that have our -_lru_cached_fns = [] - - -def lru_cache(*args, **kwargs): - """ - Thin wrapper over functools.lru_cache that lets us clear all caches later. - """ - def decorator(fn): - wrapped_fn = functools.lru_cache(*args, **kwargs)(fn) - _lru_cached_fns.append(wrapped_fn) - return wrapped_fn - return decorator - - -def clear_lru_caches(): - """ - Clear all LRU caches that use our lru_cache decorator. - - Useful for tests. - """ - for fn in _lru_cached_fns: - fn.cache_clear() diff --git a/openedx_learning/lib/test_utils.py b/openedx_learning/lib/test_utils.py deleted file mode 100644 index 5c9473113..000000000 --- a/openedx_learning/lib/test_utils.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -Test utilities for Learning Core. - -The only thing here now is a TestCase class that knows how to clean up the -caching used by the cache module in this package. -""" -import django.test - -from .cache import clear_lru_caches - - -class TestCase(django.test.TestCase): - """ - Subclass of Django's TestCase that knows how to reset caching we might use. - """ - def setUp(self) -> None: - clear_lru_caches() - super().setUp() - - def tearDown(self) -> None: - clear_lru_caches() - super().tearDown() diff --git a/openedx_tagging/__init__.py b/openedx_tagging/__init__.py deleted file mode 100644 index ea956e000..000000000 --- a/openedx_tagging/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -Open edX Tagging app. -""" diff --git a/openedx_tagging/py.typed b/openedx_tagging/py.typed deleted file mode 100644 index e69de29bb..000000000 diff --git a/projects/dev.py b/projects/dev.py index ebc3e94e6..9f7488344 100644 --- a/projects/dev.py +++ b/projects/dev.py @@ -4,7 +4,7 @@ from __future__ import annotations from pathlib import Path -from openedx_learning.api.django import openedx_learning_apps_to_install +from openedx_content.settings_api import openedx_content_backcompat_apps_to_install # Build paths inside the project like this: BASE_DIR / {dir_name} / BASE_DIR = Path(__file__).resolve().parents[1] @@ -34,8 +34,10 @@ "django.contrib.admin", "django.contrib.admindocs", - # Learning Core Apps - *openedx_learning_apps_to_install(), + # Our Apps + "openedx_tagging", + "openedx_content", + *openedx_content_backcompat_apps_to_install(), # REST API "rest_framework", @@ -43,9 +45,6 @@ # django-rules based authorization 'rules.apps.AutodiscoverRulesConfig', - # Tagging Core Apps - "openedx_tagging.core.tagging.apps.TaggingConfig", - # Debugging "debug_toolbar", ] diff --git a/projects/urls.py b/projects/urls.py index 583b004b4..6d7a37f35 100644 --- a/projects/urls.py +++ b/projects/urls.py @@ -7,7 +7,7 @@ urlpatterns = [ path("admin/doc/", include("django.contrib.admindocs.urls")), path("admin/", admin.site.urls), - path("media_server/", include("openedx_learning.contrib.media_server.urls")), - path("tagging/rest_api/", include("openedx_tagging.core.tagging.urls")), + path("media_server/", include("openedx_content.applets.media_server.urls")), + path("tagging/rest_api/", include("openedx_tagging.urls")), path('__debug__/', include('debug_toolbar.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/requirements/ci.in b/requirements/ci.in index d5f09d0cb..6959b416c 100644 --- a/requirements/ci.in +++ b/requirements/ci.in @@ -2,4 +2,3 @@ -c constraints.txt tox # Virtualenv management for tests -import-linter # Track our internal dependencies diff --git a/requirements/ci.txt b/requirements/ci.txt index f92269539..c603ebe06 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -4,42 +4,18 @@ # # make upgrade # -annotated-doc==0.0.4 - # via fastapi -annotated-types==0.7.0 - # via pydantic -anyio==4.12.1 - # via starlette cachetools==7.0.0 # via tox chardet==5.2.0 # via tox -click==8.3.1 - # via - # import-linter - # uvicorn colorama==0.4.6 # via tox distlib==0.4.0 # via virtualenv -fastapi==0.128.5 - # via import-linter filelock==3.20.3 # via # tox # virtualenv -grimp==3.14 - # via import-linter -h11==0.16.0 - # via uvicorn -idna==3.11 - # via anyio -import-linter==2.10 - # via -r requirements/ci.in -markdown-it-py==4.0.0 - # via rich -mdurl==0.1.2 - # via markdown-it-py packaging==26.0 # via # pyproject-api @@ -50,35 +26,9 @@ platformdirs==4.5.1 # virtualenv pluggy==1.6.0 # via tox -pydantic==2.12.5 - # via fastapi -pydantic-core==2.41.5 - # via pydantic -pygments==2.19.2 - # via rich pyproject-api==1.10.0 # via tox -rich==14.3.2 - # via import-linter -starlette==0.52.1 - # via fastapi tox==4.34.1 # via -r requirements/ci.in -typing-extensions==4.15.0 - # via - # anyio - # fastapi - # grimp - # import-linter - # pydantic - # pydantic-core - # starlette - # typing-inspection -typing-inspection==0.4.2 - # via - # fastapi - # pydantic -uvicorn==0.40.0 - # via import-linter virtualenv==20.36.1 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 7038d9f09..42895170e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -10,17 +10,14 @@ amqp==5.3.1 # kombu annotated-doc==0.0.4 # via - # -r requirements/ci.txt # -r requirements/quality.txt # fastapi annotated-types==0.7.0 # via - # -r requirements/ci.txt # -r requirements/quality.txt # pydantic anyio==4.12.1 # via - # -r requirements/ci.txt # -r requirements/quality.txt # starlette asgiref==3.11.1 @@ -72,7 +69,6 @@ charset-normalizer==3.4.4 # requests click==8.3.1 # via - # -r requirements/ci.txt # -r requirements/pip-tools.txt # -r requirements/quality.txt # celery @@ -118,7 +114,6 @@ cryptography==46.0.4 # via # -r requirements/quality.txt # pyjwt - # secretstorage ddt==1.7.2 # via -r requirements/quality.txt diff-cover==10.2.0 @@ -201,7 +196,6 @@ edx-opaque-keys==3.0.0 # edx-drf-extensions fastapi==0.128.5 # via - # -r requirements/ci.txt # -r requirements/quality.txt # import-linter filelock==3.20.3 @@ -213,12 +207,10 @@ freezegun==1.5.5 # via -r requirements/quality.txt grimp==3.14 # via - # -r requirements/ci.txt # -r requirements/quality.txt # import-linter h11==0.16.0 # via - # -r requirements/ci.txt # -r requirements/quality.txt # uvicorn id==1.6.1 @@ -227,14 +219,11 @@ id==1.6.1 # twine idna==3.11 # via - # -r requirements/ci.txt # -r requirements/quality.txt # anyio # requests import-linter==2.10 - # via - # -r requirements/ci.txt - # -r requirements/quality.txt + # via -r requirements/quality.txt importlib-metadata==8.7.1 # via # -r requirements/quality.txt @@ -259,11 +248,6 @@ jaraco-functools==4.4.0 # via # -r requirements/quality.txt # keyring -jeepney==0.9.0 - # via - # -r requirements/quality.txt - # keyring - # secretstorage jinja2==3.1.6 # via # -r requirements/quality.txt @@ -289,7 +273,6 @@ lxml-html-clean==0.4.3 # via lxml markdown-it-py==4.0.0 # via - # -r requirements/ci.txt # -r requirements/quality.txt # rich markupsafe==3.0.3 @@ -302,7 +285,6 @@ mccabe==0.7.0 # pylint mdurl==0.1.2 # via - # -r requirements/ci.txt # -r requirements/quality.txt # markdown-it-py mock==5.2.0 @@ -377,19 +359,16 @@ pycparser==3.0 # cffi pydantic==2.12.5 # via - # -r requirements/ci.txt # -r requirements/quality.txt # fastapi pydantic-core==2.41.5 # via - # -r requirements/ci.txt # -r requirements/quality.txt # pydantic pydocstyle==6.3.0 # via -r requirements/quality.txt pygments==2.19.2 # via - # -r requirements/ci.txt # -r requirements/quality.txt # diff-cover # pytest @@ -480,16 +459,11 @@ rfc3986==2.0.0 # twine rich==14.3.2 # via - # -r requirements/ci.txt # -r requirements/quality.txt # import-linter # twine rules==3.5 # via -r requirements/quality.txt -secretstorage==3.5.0 - # via - # -r requirements/quality.txt - # keyring semantic-version==2.10.0 # via # -r requirements/quality.txt @@ -510,7 +484,6 @@ sqlparse==0.5.5 # django-debug-toolbar starlette==0.52.1 # via - # -r requirements/ci.txt # -r requirements/quality.txt # fastapi stevedore==5.6.0 @@ -538,7 +511,6 @@ types-pyyaml==6.0.12.20250915 # djangorestframework-stubs typing-extensions==4.15.0 # via - # -r requirements/ci.txt # -r requirements/quality.txt # anyio # django-stubs @@ -555,7 +527,6 @@ typing-extensions==4.15.0 # typing-inspection typing-inspection==0.4.2 # via - # -r requirements/ci.txt # -r requirements/quality.txt # fastapi # pydantic @@ -575,7 +546,6 @@ urllib3==2.6.3 # twine uvicorn==0.40.0 # via - # -r requirements/ci.txt # -r requirements/quality.txt # import-linter vine==5.1.0 diff --git a/requirements/quality.txt b/requirements/quality.txt index cde07c3e9..ce7066d2f 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -90,7 +90,6 @@ cryptography==46.0.4 # via # -r requirements/test.txt # pyjwt - # secretstorage ddt==1.7.2 # via -r requirements/test.txt dill==0.4.1 @@ -195,10 +194,6 @@ jaraco-context==6.1.0 # via keyring jaraco-functools==4.4.0 # via keyring -jeepney==0.9.0 - # via - # keyring - # secretstorage jinja2==3.1.6 # via # -r requirements/test.txt @@ -358,8 +353,6 @@ rich==14.3.2 # twine rules==3.5 # via -r requirements/test.txt -secretstorage==3.5.0 - # via keyring semantic-version==2.10.0 # via # -r requirements/test.txt diff --git a/setup.py b/setup.py index 3dbaa6b47..99ee848a0 100755 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ def is_requirement(line): return line and not line.startswith(('-r', '#', '-e', 'git+', '-c')) -VERSION = get_version('openedx_learning', '__init__.py') +VERSION = get_version('src', 'openedx_core', '__init__.py') if sys.argv[-1] == 'tag': print("Tagging the version on github:") @@ -72,10 +72,8 @@ def is_requirement(line): author='David Ormsbee', author_email='dave@tcril.org', url='https://github.com/openedx/openedx-learning', - packages=find_packages( - include=['openedx_learning*', 'openedx_tagging*'], - exclude=['*.test', '*.tests'] - ), + package_dir={"": "src"}, + packages=find_packages("src"), include_package_data=True, install_requires=load_requirements('requirements/base.in'), python_requires=">=3.11", diff --git a/openedx_learning/api/__init__.py b/src/openedx_content/__init__.py similarity index 100% rename from openedx_learning/api/__init__.py rename to src/openedx_content/__init__.py diff --git a/openedx_learning/apps/openedx_content/admin.py b/src/openedx_content/admin.py similarity index 100% rename from openedx_learning/apps/openedx_content/admin.py rename to src/openedx_content/admin.py diff --git a/src/openedx_content/api.py b/src/openedx_content/api.py new file mode 100644 index 000000000..67f690ae0 --- /dev/null +++ b/src/openedx_content/api.py @@ -0,0 +1,20 @@ +""" +This is the public API for content authoring in the Open edX Core. + +This is the single ``api`` module that code outside of the +``openedx_content.*`` package should import from. It will +re-export the public functions from all api.py modules of its applets. +It may also implement its own convenience APIs that wrap calls to multiple app +APIs. +""" + +# These wildcard imports are okay because these api modules declare __all__. +# pylint: disable=wildcard-import +from .applets.backup_restore.api import * +from .applets.collections.api import * +from .applets.components.api import * +from .applets.contents.api import * +from .applets.publishing.api import * +from .applets.sections.api import * +from .applets.subsections.api import * +from .applets.units.api import * diff --git a/openedx_learning/apps/__init__.py b/src/openedx_content/applets/__init__.py similarity index 100% rename from openedx_learning/apps/__init__.py rename to src/openedx_content/applets/__init__.py diff --git a/openedx_learning/apps/openedx_content/__init__.py b/src/openedx_content/applets/backup_restore/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/__init__.py rename to src/openedx_content/applets/backup_restore/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/admin.py b/src/openedx_content/applets/backup_restore/admin.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/admin.py rename to src/openedx_content/applets/backup_restore/admin.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/api.py b/src/openedx_content/applets/backup_restore/api.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/api.py rename to src/openedx_content/applets/backup_restore/api.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/models.py b/src/openedx_content/applets/backup_restore/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/models.py rename to src/openedx_content/applets/backup_restore/models.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/serializers.py b/src/openedx_content/applets/backup_restore/serializers.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/serializers.py rename to src/openedx_content/applets/backup_restore/serializers.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/toml.py b/src/openedx_content/applets/backup_restore/toml.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/toml.py rename to src/openedx_content/applets/backup_restore/toml.py diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/zipper.py b/src/openedx_content/applets/backup_restore/zipper.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/backup_restore/zipper.py rename to src/openedx_content/applets/backup_restore/zipper.py index 5b9ce6fb3..5c45942a7 100644 --- a/openedx_learning/apps/openedx_content/applets/backup_restore/zipper.py +++ b/src/openedx_content/applets/backup_restore/zipper.py @@ -18,7 +18,7 @@ from django.utils.text import slugify from rest_framework import serializers -from openedx_learning.api.authoring_models import ( +from openedx_content.models_api import ( Collection, ComponentType, ComponentVersion, diff --git a/openedx_learning/apps/openedx_content/applets/__init__.py b/src/openedx_content/applets/collections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/__init__.py rename to src/openedx_content/applets/collections/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/collections/admin.py b/src/openedx_content/applets/collections/admin.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/collections/admin.py rename to src/openedx_content/applets/collections/admin.py diff --git a/openedx_learning/apps/openedx_content/applets/collections/api.py b/src/openedx_content/applets/collections/api.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/collections/api.py rename to src/openedx_content/applets/collections/api.py index c73c21acc..f23b6fbc5 100644 --- a/openedx_learning/apps/openedx_content/applets/collections/api.py +++ b/src/openedx_content/applets/collections/api.py @@ -12,7 +12,7 @@ from ..publishing.models import PublishableEntity from .models import Collection, CollectionPublishableEntity -# The public API that will be re-exported by openedx_learning.apps.openedx_content.api +# The public API that will be re-exported by openedx_content.api # is listed in the __all__ entries below. Internal helper functions that are # private to this module should start with an underscore. If a function does not # start with an underscore AND it is not in __all__, that function is considered diff --git a/openedx_learning/apps/openedx_content/applets/collections/models.py b/src/openedx_content/applets/collections/models.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/collections/models.py rename to src/openedx_content/applets/collections/models.py index 22bc08c12..51ac7e323 100644 --- a/openedx_learning/apps/openedx_content/applets/collections/models.py +++ b/src/openedx_content/applets/collections/models.py @@ -70,8 +70,8 @@ from django.db import models from django.utils.translation import gettext_lazy as _ -from openedx_learning.lib.fields import MultiCollationTextField, case_insensitive_char_field, key_field -from openedx_learning.lib.validators import validate_utc_datetime +from openedx_django_lib.fields import MultiCollationTextField, case_insensitive_char_field, key_field +from openedx_django_lib.validators import validate_utc_datetime from ..publishing.models import LearningPackage, PublishableEntity diff --git a/openedx_learning/apps/openedx_content/applets/collections/readme.rst b/src/openedx_content/applets/collections/readme.rst similarity index 100% rename from openedx_learning/apps/openedx_content/applets/collections/readme.rst rename to src/openedx_content/applets/collections/readme.rst diff --git a/openedx_learning/apps/openedx_content/applets/backup_restore/__init__.py b/src/openedx_content/applets/components/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/backup_restore/__init__.py rename to src/openedx_content/applets/components/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/components/admin.py b/src/openedx_content/applets/components/admin.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/components/admin.py rename to src/openedx_content/applets/components/admin.py index a7d51c82e..dcc02f9f3 100644 --- a/openedx_learning/apps/openedx_content/applets/components/admin.py +++ b/src/openedx_content/applets/components/admin.py @@ -9,7 +9,7 @@ from django.utils.html import format_html from django.utils.safestring import SafeText -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin from .models import Component, ComponentVersion, ComponentVersionContent diff --git a/openedx_learning/apps/openedx_content/applets/components/api.py b/src/openedx_content/applets/components/api.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/components/api.py rename to src/openedx_content/applets/components/api.py index 588bd40b9..ae4d6c2df 100644 --- a/openedx_learning/apps/openedx_content/applets/components/api.py +++ b/src/openedx_content/applets/components/api.py @@ -27,7 +27,7 @@ from ..publishing import api as publishing_api from .models import Component, ComponentType, ComponentVersion, ComponentVersionContent -# The public API that will be re-exported by openedx_learning.apps.openedx_content.api +# The public API that will be re-exported by openedx_content.api # is listed in the __all__ entries below. Internal helper functions that are # private to this module should start with an underscore. If a function does not # start with an underscore AND it is not in __all__, that function is considered diff --git a/openedx_learning/apps/openedx_content/applets/components/models.py b/src/openedx_content/applets/components/models.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/components/models.py rename to src/openedx_content/applets/components/models.py index 407fca2f8..bf86a4e48 100644 --- a/openedx_learning/apps/openedx_content/applets/components/models.py +++ b/src/openedx_content/applets/components/models.py @@ -21,8 +21,8 @@ from django.db import models -from openedx_learning.lib.fields import case_sensitive_char_field, key_field -from openedx_learning.lib.managers import WithRelationsManager +from openedx_django_lib.fields import case_sensitive_char_field, key_field +from openedx_django_lib.managers import WithRelationsManager from ..contents.models import Content from ..publishing.models import LearningPackage, PublishableEntityMixin, PublishableEntityVersionMixin diff --git a/openedx_learning/apps/openedx_content/applets/components/readme.rst b/src/openedx_content/applets/components/readme.rst similarity index 100% rename from openedx_learning/apps/openedx_content/applets/components/readme.rst rename to src/openedx_content/applets/components/readme.rst diff --git a/openedx_learning/apps/openedx_content/applets/collections/__init__.py b/src/openedx_content/applets/contents/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/collections/__init__.py rename to src/openedx_content/applets/contents/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/contents/admin.py b/src/openedx_content/applets/contents/admin.py similarity index 96% rename from openedx_learning/apps/openedx_content/applets/contents/admin.py rename to src/openedx_content/applets/contents/admin.py index 029ebfd86..b845073d5 100644 --- a/openedx_learning/apps/openedx_content/applets/contents/admin.py +++ b/src/openedx_content/applets/contents/admin.py @@ -6,7 +6,7 @@ from django.contrib import admin from django.utils.html import format_html -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin from .models import Content diff --git a/openedx_learning/apps/openedx_content/applets/contents/api.py b/src/openedx_content/applets/contents/api.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/contents/api.py rename to src/openedx_content/applets/contents/api.py index 82ce5e44c..b7495e7c0 100644 --- a/openedx_learning/apps/openedx_content/applets/contents/api.py +++ b/src/openedx_content/applets/contents/api.py @@ -12,11 +12,11 @@ from django.core.files.base import ContentFile from django.db.transaction import atomic -from openedx_learning.lib.fields import create_hash_digest +from openedx_django_lib.fields import create_hash_digest from .models import Content, MediaType -# The public API that will be re-exported by openedx_learning.apps.openedx_content.api +# The public API that will be re-exported by openedx_content.api # is listed in the __all__ entries below. Internal helper functions that are # private to this module should start with an underscore. If a function does not # start with an underscore AND it is not in __all__, that function is considered diff --git a/openedx_learning/apps/openedx_content/applets/contents/models.py b/src/openedx_content/applets/contents/models.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/contents/models.py rename to src/openedx_content/applets/contents/models.py index e90fd2b0a..31c565e68 100644 --- a/openedx_learning/apps/openedx_content/applets/contents/models.py +++ b/src/openedx_content/applets/contents/models.py @@ -16,13 +16,13 @@ from django.db import models from django.utils.module_loading import import_string -from openedx_learning.lib.fields import ( +from openedx_django_lib.fields import ( MultiCollationTextField, case_insensitive_char_field, hash_field, manual_date_time_field, ) -from openedx_learning.lib.managers import WithRelationsManager +from openedx_django_lib.managers import WithRelationsManager from ..publishing.models import LearningPackage diff --git a/openedx_learning/contrib/media_server/__init__.py b/src/openedx_content/applets/media_server/__init__.py similarity index 100% rename from openedx_learning/contrib/media_server/__init__.py rename to src/openedx_content/applets/media_server/__init__.py diff --git a/openedx_learning/contrib/media_server/apps.py b/src/openedx_content/applets/media_server/apps.py similarity index 93% rename from openedx_learning/contrib/media_server/apps.py rename to src/openedx_content/applets/media_server/apps.py index 04706c755..7f9a08a4e 100644 --- a/openedx_learning/contrib/media_server/apps.py +++ b/src/openedx_content/applets/media_server/apps.py @@ -11,7 +11,7 @@ class MediaServerConfig(AppConfig): Configuration for the Media Server application. """ - name = "openedx_learning.contrib.media_server" + name = "openedx_content.applets.media_server" verbose_name = "Learning Core: Media Server" default_auto_field = "django.db.models.BigAutoField" diff --git a/openedx_learning/contrib/media_server/readme.rst b/src/openedx_content/applets/media_server/readme.rst similarity index 100% rename from openedx_learning/contrib/media_server/readme.rst rename to src/openedx_content/applets/media_server/readme.rst diff --git a/openedx_learning/contrib/media_server/urls.py b/src/openedx_content/applets/media_server/urls.py similarity index 100% rename from openedx_learning/contrib/media_server/urls.py rename to src/openedx_content/applets/media_server/urls.py diff --git a/openedx_learning/contrib/media_server/views.py b/src/openedx_content/applets/media_server/views.py similarity index 92% rename from openedx_learning/contrib/media_server/views.py rename to src/openedx_content/applets/media_server/views.py index bfc5a4b6d..71421978d 100644 --- a/openedx_learning/contrib/media_server/views.py +++ b/src/openedx_content/applets/media_server/views.py @@ -8,7 +8,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.http import FileResponse, Http404 -from openedx_learning.apps.openedx_content.applets.components.api import look_up_component_version_content +from openedx_content.applets.components.api import look_up_component_version_content def component_asset( diff --git a/openedx_learning/apps/openedx_content/applets/components/__init__.py b/src/openedx_content/applets/publishing/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/components/__init__.py rename to src/openedx_content/applets/publishing/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/admin.py b/src/openedx_content/applets/publishing/admin.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/publishing/admin.py rename to src/openedx_content/applets/publishing/admin.py index 367111305..797decf8a 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/admin.py +++ b/src/openedx_content/applets/publishing/admin.py @@ -10,7 +10,7 @@ from django.utils.html import format_html from django.utils.safestring import SafeText -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin, model_detail_link, one_to_one_related_model_html +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin, model_detail_link, one_to_one_related_model_html from .models import ( Container, diff --git a/openedx_learning/apps/openedx_content/applets/publishing/api.py b/src/openedx_content/applets/publishing/api.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/publishing/api.py rename to src/openedx_content/applets/publishing/api.py index 375db9cc4..64b190a09 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/api.py +++ b/src/openedx_content/applets/publishing/api.py @@ -16,7 +16,7 @@ from django.db.models import F, Prefetch, Q, QuerySet from django.db.transaction import atomic -from openedx_learning.lib.fields import create_hash_digest +from openedx_django_lib.fields import create_hash_digest from .contextmanagers import DraftChangeLogContext from .models import ( @@ -47,7 +47,7 @@ ContainerModel = TypeVar('ContainerModel', bound=Container) ContainerVersionModel = TypeVar('ContainerVersionModel', bound=ContainerVersion) -# The public API that will be re-exported by openedx_learning.apps.openedx_content.api +# The public API that will be re-exported by openedx_content.api # is listed in the __all__ entries below. Internal helper functions that are # private to this module should start with an underscore. If a function does not # start with an underscore AND it is not in __all__, that function is considered diff --git a/openedx_learning/apps/openedx_content/applets/publishing/contextmanagers.py b/src/openedx_content/applets/publishing/contextmanagers.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/contextmanagers.py rename to src/openedx_content/applets/publishing/contextmanagers.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/__init__.py b/src/openedx_content/applets/publishing/models/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/models/__init__.py rename to src/openedx_content/applets/publishing/models/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/container.py b/src/openedx_content/applets/publishing/models/container.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/models/container.py rename to src/openedx_content/applets/publishing/models/container.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/draft_log.py b/src/openedx_content/applets/publishing/models/draft_log.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/publishing/models/draft_log.py rename to src/openedx_content/applets/publishing/models/draft_log.py index ed3eb8731..18ebf313b 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/models/draft_log.py +++ b/src/openedx_content/applets/publishing/models/draft_log.py @@ -6,7 +6,7 @@ from django.db.models import F, Q from django.utils.translation import gettext_lazy as _ -from openedx_learning.lib.fields import hash_field, immutable_uuid_field, manual_date_time_field +from openedx_django_lib.fields import hash_field, immutable_uuid_field, manual_date_time_field from .learning_package import LearningPackage from .publishable_entity import PublishableEntity, PublishableEntityVersion diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/entity_list.py b/src/openedx_content/applets/publishing/models/entity_list.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/models/entity_list.py rename to src/openedx_content/applets/publishing/models/entity_list.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/learning_package.py b/src/openedx_content/applets/publishing/models/learning_package.py similarity index 98% rename from openedx_learning/apps/openedx_content/applets/publishing/models/learning_package.py rename to src/openedx_content/applets/publishing/models/learning_package.py index 3ff5bb4bd..9e6d6a776 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/models/learning_package.py +++ b/src/openedx_content/applets/publishing/models/learning_package.py @@ -3,7 +3,7 @@ """ from django.db import models -from openedx_learning.lib.fields import ( +from openedx_django_lib.fields import ( MultiCollationTextField, case_insensitive_char_field, immutable_uuid_field, diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/publish_log.py b/src/openedx_content/applets/publishing/models/publish_log.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/publishing/models/publish_log.py rename to src/openedx_content/applets/publishing/models/publish_log.py index d3bc1241f..3f88f31e2 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/models/publish_log.py +++ b/src/openedx_content/applets/publishing/models/publish_log.py @@ -5,7 +5,7 @@ from django.db import models from django.utils.translation import gettext_lazy as _ -from openedx_learning.lib.fields import ( +from openedx_django_lib.fields import ( case_insensitive_char_field, hash_field, immutable_uuid_field, diff --git a/openedx_learning/apps/openedx_content/applets/publishing/models/publishable_entity.py b/src/openedx_content/applets/publishing/models/publishable_entity.py similarity index 99% rename from openedx_learning/apps/openedx_content/applets/publishing/models/publishable_entity.py rename to src/openedx_content/applets/publishing/models/publishable_entity.py index 176735a44..42e9a4a9c 100644 --- a/openedx_learning/apps/openedx_content/applets/publishing/models/publishable_entity.py +++ b/src/openedx_content/applets/publishing/models/publishable_entity.py @@ -13,13 +13,13 @@ from django.db import models from django.utils.translation import gettext as _ -from openedx_learning.lib.fields import ( +from openedx_django_lib.fields import ( case_insensitive_char_field, immutable_uuid_field, key_field, manual_date_time_field, ) -from openedx_learning.lib.managers import WithRelationsManager +from openedx_django_lib.managers import WithRelationsManager from .learning_package import LearningPackage diff --git a/openedx_learning/apps/openedx_content/applets/publishing/readme.rst b/src/openedx_content/applets/publishing/readme.rst similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/readme.rst rename to src/openedx_content/applets/publishing/readme.rst diff --git a/openedx_learning/apps/openedx_content/applets/contents/__init__.py b/src/openedx_content/applets/sections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/contents/__init__.py rename to src/openedx_content/applets/sections/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/sections/admin.py b/src/openedx_content/applets/sections/admin.py similarity index 95% rename from openedx_learning/apps/openedx_content/applets/sections/admin.py rename to src/openedx_content/applets/sections/admin.py index af35c180e..e0c081059 100644 --- a/openedx_learning/apps/openedx_content/applets/sections/admin.py +++ b/src/openedx_content/applets/sections/admin.py @@ -4,7 +4,7 @@ from django.contrib import admin from django.utils.safestring import SafeText -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin, model_detail_link +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin, model_detail_link from ..publishing.models import ContainerVersion from .models import Section, SectionVersion diff --git a/openedx_learning/apps/openedx_content/applets/sections/api.py b/src/openedx_content/applets/sections/api.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/sections/api.py rename to src/openedx_content/applets/sections/api.py diff --git a/openedx_learning/apps/openedx_content/applets/sections/models.py b/src/openedx_content/applets/sections/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/sections/models.py rename to src/openedx_content/applets/sections/models.py diff --git a/openedx_learning/apps/openedx_content/applets/publishing/__init__.py b/src/openedx_content/applets/subsections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/publishing/__init__.py rename to src/openedx_content/applets/subsections/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/subsections/admin.py b/src/openedx_content/applets/subsections/admin.py similarity index 95% rename from openedx_learning/apps/openedx_content/applets/subsections/admin.py rename to src/openedx_content/applets/subsections/admin.py index 50c6ad620..d9d197b3c 100644 --- a/openedx_learning/apps/openedx_content/applets/subsections/admin.py +++ b/src/openedx_content/applets/subsections/admin.py @@ -4,7 +4,7 @@ from django.contrib import admin from django.utils.safestring import SafeText -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin, model_detail_link +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin, model_detail_link from ..publishing.models import ContainerVersion from .models import Subsection, SubsectionVersion diff --git a/openedx_learning/apps/openedx_content/applets/subsections/api.py b/src/openedx_content/applets/subsections/api.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/subsections/api.py rename to src/openedx_content/applets/subsections/api.py diff --git a/openedx_learning/apps/openedx_content/applets/subsections/models.py b/src/openedx_content/applets/subsections/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/subsections/models.py rename to src/openedx_content/applets/subsections/models.py diff --git a/openedx_learning/apps/openedx_content/applets/sections/__init__.py b/src/openedx_content/applets/units/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/sections/__init__.py rename to src/openedx_content/applets/units/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/units/admin.py b/src/openedx_content/applets/units/admin.py similarity index 95% rename from openedx_learning/apps/openedx_content/applets/units/admin.py rename to src/openedx_content/applets/units/admin.py index 3ebd9a27c..d079875f8 100644 --- a/openedx_learning/apps/openedx_content/applets/units/admin.py +++ b/src/openedx_content/applets/units/admin.py @@ -4,7 +4,7 @@ from django.contrib import admin from django.utils.safestring import SafeText -from openedx_learning.lib.admin_utils import ReadOnlyModelAdmin, model_detail_link +from openedx_django_lib.admin_utils import ReadOnlyModelAdmin, model_detail_link from ..publishing.models import ContainerVersion from .models import Unit, UnitVersion diff --git a/openedx_learning/apps/openedx_content/applets/units/api.py b/src/openedx_content/applets/units/api.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/units/api.py rename to src/openedx_content/applets/units/api.py diff --git a/openedx_learning/apps/openedx_content/applets/units/models.py b/src/openedx_content/applets/units/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/units/models.py rename to src/openedx_content/applets/units/models.py diff --git a/openedx_learning/apps/openedx_content/apps.py b/src/openedx_content/apps.py similarity index 94% rename from openedx_learning/apps/openedx_content/apps.py rename to src/openedx_content/apps.py index 28d25b927..563d5d03a 100644 --- a/openedx_learning/apps/openedx_content/apps.py +++ b/src/openedx_content/apps.py @@ -15,8 +15,8 @@ class ContentConfig(AppConfig): Initialization for all applets must happen in here. """ - name = "openedx_learning.apps.openedx_content" - verbose_name = "Learning Core > Content" + name = "openedx_content" + verbose_name = "Open edX Core > Content" default_auto_field = "django.db.models.BigAutoField" label = "openedx_content" diff --git a/openedx_learning/apps/openedx_content/applets/subsections/__init__.py b/src/openedx_content/backcompat/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/subsections/__init__.py rename to src/openedx_content/backcompat/__init__.py diff --git a/openedx_learning/apps/openedx_content/applets/units/__init__.py b/src/openedx_content/backcompat/backup_restore/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/applets/units/__init__.py rename to src/openedx_content/backcompat/backup_restore/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/backup_restore/apps.py b/src/openedx_content/backcompat/backup_restore/apps.py similarity index 78% rename from openedx_learning/apps/openedx_content/backcompat/backup_restore/apps.py rename to src/openedx_content/backcompat/backup_restore/apps.py index b7517cf9c..73ae192ae 100644 --- a/openedx_learning/apps/openedx_content/backcompat/backup_restore/apps.py +++ b/src/openedx_content/backcompat/backup_restore/apps.py @@ -6,7 +6,7 @@ class BackupRestoreConfig(AppConfig): - name = 'openedx_learning.apps.openedx_content.backcompat.backup_restore' + name = 'openedx_content.backcompat.backup_restore' verbose_name = "Learning Core > Authoring > Backup Restore" default_auto_field = 'django.db.models.BigAutoField' label = "oel_backup_restore" diff --git a/openedx_learning/apps/openedx_content/backcompat/__init__.py b/src/openedx_content/backcompat/backup_restore/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/__init__.py rename to src/openedx_content/backcompat/backup_restore/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/backup_restore/__init__.py b/src/openedx_content/backcompat/collections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/backup_restore/__init__.py rename to src/openedx_content/backcompat/collections/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/apps.py b/src/openedx_content/backcompat/collections/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/collections/apps.py rename to src/openedx_content/backcompat/collections/apps.py index 3f326bc84..a34325c51 100644 --- a/openedx_learning/apps/openedx_content/backcompat/collections/apps.py +++ b/src/openedx_content/backcompat/collections/apps.py @@ -9,7 +9,7 @@ class CollectionsConfig(AppConfig): Configuration for the Collections Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.collections" + name = "openedx_content.backcompat.collections" verbose_name = "Learning Core > Authoring > Collections" default_auto_field = "django.db.models.BigAutoField" label = "oel_collections" diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0001_initial.py b/src/openedx_content/backcompat/collections/migrations/0001_initial.py similarity index 65% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0001_initial.py rename to src/openedx_content/backcompat/collections/migrations/0001_initial.py index 0fdee2734..2ab06d18c 100644 --- a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0001_initial.py +++ b/src/openedx_content/backcompat/collections/migrations/0001_initial.py @@ -3,7 +3,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -19,8 +19,8 @@ class Migration(migrations.Migration): name='Collection', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('name', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, db_index=True, help_text='The name of the collection.', max_length=255)), - ('description', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='Provides extra information for the user about this collection.', max_length=10000)), + ('name', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, db_index=True, help_text='The name of the collection.', max_length=255)), + ('description', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='Provides extra information for the user about this collection.', max_length=10000)), ('enabled', models.BooleanField(default=True, help_text='Whether the collection is enabled or not.')), ('created', models.DateTimeField(auto_now_add=True)), ('modified', models.DateTimeField(auto_now=True)), diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py b/src/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py similarity index 69% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py rename to src/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py index eee95e509..c373ba812 100644 --- a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py +++ b/src/openedx_content/backcompat/collections/migrations/0002_remove_collection_name_collection_created_by_and_more.py @@ -4,8 +4,8 @@ from django.conf import settings from django.db import migrations, models -import openedx_learning.lib.fields -import openedx_learning.lib.validators +import openedx_django_lib.fields +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -28,23 +28,23 @@ class Migration(migrations.Migration): migrations.AddField( model_name='collection', name='title', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='Collection', help_text='The title of the collection.', max_length=500), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='Collection', help_text='The title of the collection.', max_length=500), preserve_default=False, ), migrations.AlterField( model_name='collection', name='created', - field=models.DateTimeField(auto_now_add=True, validators=[openedx_learning.lib.validators.validate_utc_datetime]), + field=models.DateTimeField(auto_now_add=True, validators=[openedx_django_lib.validators.validate_utc_datetime]), ), migrations.AlterField( model_name='collection', name='description', - field=openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', help_text='Provides extra information for the user about this collection.', max_length=10000), + field=openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', help_text='Provides extra information for the user about this collection.', max_length=10000), ), migrations.AlterField( model_name='collection', name='modified', - field=models.DateTimeField(auto_now=True, validators=[openedx_learning.lib.validators.validate_utc_datetime]), + field=models.DateTimeField(auto_now=True, validators=[openedx_django_lib.validators.validate_utc_datetime]), ), migrations.AddIndex( model_name='collection', diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0003_collection_entities.py b/src/openedx_content/backcompat/collections/migrations/0003_collection_entities.py similarity index 93% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0003_collection_entities.py rename to src/openedx_content/backcompat/collections/migrations/0003_collection_entities.py index 1c5e84055..d5d5f97d4 100644 --- a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0003_collection_entities.py +++ b/src/openedx_content/backcompat/collections/migrations/0003_collection_entities.py @@ -4,7 +4,7 @@ from django.conf import settings from django.db import migrations, models -import openedx_learning.lib.validators +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -20,7 +20,7 @@ class Migration(migrations.Migration): name='CollectionPublishableEntity', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_django_lib.validators.validate_utc_datetime])), ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='oel_collections.collection')), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('entity', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='oel_publishing.publishableentity')), diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0004_collection_key.py b/src/openedx_content/backcompat/collections/migrations/0004_collection_key.py similarity index 91% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0004_collection_key.py rename to src/openedx_content/backcompat/collections/migrations/0004_collection_key.py index 843419eec..d20db64bf 100644 --- a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0004_collection_key.py +++ b/src/openedx_content/backcompat/collections/migrations/0004_collection_key.py @@ -3,7 +3,7 @@ from django.db import migrations, models from django.utils.crypto import get_random_string -import openedx_learning.lib.fields +import openedx_django_lib.fields def generate_keys(apps, schema_editor): @@ -33,7 +33,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='collection', name='key', - field=openedx_learning.lib.fields.MultiCollationCharField( + field=openedx_django_lib.fields.MultiCollationCharField( db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500, null=True, blank=True), preserve_default=False, @@ -44,7 +44,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='collection', name='key', - field=openedx_learning.lib.fields.MultiCollationCharField( + field=openedx_django_lib.fields.MultiCollationCharField( db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500, null=False, blank=False), preserve_default=False, diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py b/src/openedx_content/backcompat/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py rename to src/openedx_content/backcompat/collections/migrations/0005_alter_collection_options_alter_collection_enabled.py diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/0006_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/collections/migrations/0006_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/0006_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/collections/migrations/0006_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/backup_restore/migrations/__init__.py b/src/openedx_content/backcompat/collections/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/backup_restore/migrations/__init__.py rename to src/openedx_content/backcompat/collections/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/models.py b/src/openedx_content/backcompat/collections/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/collections/models.py rename to src/openedx_content/backcompat/collections/models.py diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/__init__.py b/src/openedx_content/backcompat/components/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/collections/__init__.py rename to src/openedx_content/backcompat/components/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/apps.py b/src/openedx_content/backcompat/components/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/components/apps.py rename to src/openedx_content/backcompat/components/apps.py index 4a6ab9edf..fbc7cc424 100644 --- a/openedx_learning/apps/openedx_content/backcompat/components/apps.py +++ b/src/openedx_content/backcompat/components/apps.py @@ -9,7 +9,7 @@ class ComponentsConfig(AppConfig): Configuration for the Components Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.components" + name = "openedx_content.backcompat.components" verbose_name = "Learning Core > Authoring > Components" default_auto_field = "django.db.models.BigAutoField" label = "oel_components" diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0001_initial.py b/src/openedx_content/backcompat/components/migrations/0001_initial.py similarity index 85% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/0001_initial.py rename to src/openedx_content/backcompat/components/migrations/0001_initial.py index ece93796e..8c36eb17b 100644 --- a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0001_initial.py +++ b/src/openedx_content/backcompat/components/migrations/0001_initial.py @@ -5,7 +5,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -22,7 +22,7 @@ class Migration(migrations.Migration): name='Component', fields=[ ('publishable_entity', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='oel_publishing.publishableentity')), - ('local_key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), + ('local_key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), ], options={ 'verbose_name': 'Component', @@ -33,8 +33,8 @@ class Migration(migrations.Migration): name='ComponentType', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('namespace', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), - ('name', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), + ('namespace', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), + ('name', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), ], ), migrations.CreateModel( @@ -53,7 +53,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), ('learner_downloadable', models.BooleanField(default=False)), ('component_version', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='oel_components.componentversion')), ('content', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='oel_contents.content')), diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py b/src/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py similarity index 62% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py rename to src/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py index ee12970d2..2ab431aa8 100644 --- a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py +++ b/src/openedx_content/backcompat/components/migrations/0002_alter_componentversioncontent_key.py @@ -2,7 +2,7 @@ from django.db import migrations -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='componentversioncontent', name='key', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), ), ] diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py b/src/openedx_content/backcompat/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py rename to src/openedx_content/backcompat/components/migrations/0003_remove_componentversioncontent_learner_downloadable.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0004_remove_componentversioncontent_uuid.py b/src/openedx_content/backcompat/components/migrations/0004_remove_componentversioncontent_uuid.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/0004_remove_componentversioncontent_uuid.py rename to src/openedx_content/backcompat/components/migrations/0004_remove_componentversioncontent_uuid.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/0005_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/components/migrations/0005_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/0005_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/components/migrations/0005_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/collections/migrations/__init__.py b/src/openedx_content/backcompat/components/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/collections/migrations/__init__.py rename to src/openedx_content/backcompat/components/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/models.py b/src/openedx_content/backcompat/components/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/models.py rename to src/openedx_content/backcompat/components/models.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/__init__.py b/src/openedx_content/backcompat/contents/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/__init__.py rename to src/openedx_content/backcompat/contents/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/contents/apps.py b/src/openedx_content/backcompat/contents/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/contents/apps.py rename to src/openedx_content/backcompat/contents/apps.py index 38a1e4730..aed1cd5c5 100644 --- a/openedx_learning/apps/openedx_content/backcompat/contents/apps.py +++ b/src/openedx_content/backcompat/contents/apps.py @@ -9,7 +9,7 @@ class ContentsConfig(AppConfig): Configuration for the Contents Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.contents" + name = "openedx_content.backcompat.contents" verbose_name = "Learning Core > Authoring > Contents" default_auto_field = "django.db.models.BigAutoField" label = "oel_contents" diff --git a/openedx_learning/apps/openedx_content/backcompat/contents/migrations/0001_initial.py b/src/openedx_content/backcompat/contents/migrations/0001_initial.py similarity index 73% rename from openedx_learning/apps/openedx_content/backcompat/contents/migrations/0001_initial.py rename to src/openedx_content/backcompat/contents/migrations/0001_initial.py index 1abf65adf..248e7eb59 100644 --- a/openedx_learning/apps/openedx_content/backcompat/contents/migrations/0001_initial.py +++ b/src/openedx_content/backcompat/contents/migrations/0001_initial.py @@ -4,8 +4,8 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields -import openedx_learning.lib.validators +import openedx_django_lib.fields +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -24,8 +24,8 @@ class Migration(migrations.Migration): ('size', models.PositiveBigIntegerField(validators=[django.core.validators.MaxValueValidator(50000000)])), ('hash_digest', models.CharField(editable=False, max_length=40)), ('has_file', models.BooleanField()), - ('text', openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=50000, null=True)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('text', openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=50000, null=True)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ], options={ 'verbose_name': 'Content', @@ -36,9 +36,9 @@ class Migration(migrations.Migration): name='MediaType', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('type', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), - ('sub_type', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), - ('suffix', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('type', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('sub_type', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('suffix', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), ], ), migrations.AddConstraint( diff --git a/openedx_learning/apps/openedx_content/backcompat/contents/migrations/0002_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/contents/migrations/0002_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/contents/migrations/0002_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/contents/migrations/0002_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/components/migrations/__init__.py b/src/openedx_content/backcompat/contents/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/components/migrations/__init__.py rename to src/openedx_content/backcompat/contents/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/contents/__init__.py b/src/openedx_content/backcompat/publishing/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/contents/__init__.py rename to src/openedx_content/backcompat/publishing/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/apps.py b/src/openedx_content/backcompat/publishing/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/publishing/apps.py rename to src/openedx_content/backcompat/publishing/apps.py index 22ff5f6c5..19de6f241 100644 --- a/openedx_learning/apps/openedx_content/backcompat/publishing/apps.py +++ b/src/openedx_content/backcompat/publishing/apps.py @@ -9,7 +9,7 @@ class PublishingConfig(AppConfig): Configuration for the publishing Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.publishing" + name = "openedx_content.backcompat.publishing" verbose_name = "Learning Core > Authoring > Publishing" default_auto_field = "django.db.models.BigAutoField" label = "oel_publishing" diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0001_initial.py b/src/openedx_content/backcompat/publishing/migrations/0001_initial.py similarity index 86% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0001_initial.py rename to src/openedx_content/backcompat/publishing/migrations/0001_initial.py index 6ffb8b857..d2b34063d 100644 --- a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0001_initial.py +++ b/src/openedx_content/backcompat/publishing/migrations/0001_initial.py @@ -7,8 +7,8 @@ from django.conf import settings from django.db import migrations, models -import openedx_learning.lib.fields -import openedx_learning.lib.validators +import openedx_django_lib.fields +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -25,11 +25,11 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), - ('title', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=500)), - ('description', openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=10000)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), - ('updated', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), + ('title', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=500)), + ('description', openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=10000)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), + ('updated', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ], options={ 'verbose_name': 'Learning Package', @@ -41,8 +41,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('learning_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='publishable_entities', to='oel_publishing.learningpackage')), ], @@ -56,9 +56,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('title', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), + ('title', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), ('version_num', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)])), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='oel_publishing.publishableentity')), ], @@ -72,8 +72,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('message', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), - ('published_at', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('message', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), + ('published_at', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('learning_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='oel_publishing.learningpackage')), ('published_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ], diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py b/src/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py similarity index 54% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py rename to src/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py index 0a4c3b48f..65178953c 100644 --- a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py +++ b/src/openedx_content/backcompat/publishing/migrations/0002_alter_learningpackage_key_and_more.py @@ -2,7 +2,7 @@ from django.db import migrations -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -15,11 +15,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='learningpackage', name='key', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), ), migrations.AlterField( model_name='publishableentity', name='key', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), ), ] diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0003_containers.py b/src/openedx_content/backcompat/publishing/migrations/0003_containers.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0003_containers.py rename to src/openedx_content/backcompat/publishing/migrations/0003_containers.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0004_publishableentity_can_stand_alone.py b/src/openedx_content/backcompat/publishing/migrations/0004_publishableentity_can_stand_alone.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0004_publishableentity_can_stand_alone.py rename to src/openedx_content/backcompat/publishing/migrations/0004_publishableentity_can_stand_alone.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0005_alter_entitylistrow_options.py b/src/openedx_content/backcompat/publishing/migrations/0005_alter_entitylistrow_options.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0005_alter_entitylistrow_options.py rename to src/openedx_content/backcompat/publishing/migrations/0005_alter_entitylistrow_options.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py b/src/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py similarity index 97% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py rename to src/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py index b72e16843..52b3647ed 100644 --- a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py +++ b/src/openedx_content/backcompat/publishing/migrations/0006_draftchangelog.py @@ -6,7 +6,7 @@ from django.conf import settings from django.db import migrations, models -import openedx_learning.lib.validators +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -22,7 +22,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('changed_at', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('changed_at', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('learning_package', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='oel_publishing.learningpackage')), ], diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0007_bootstrap_draftchangelog.py b/src/openedx_content/backcompat/publishing/migrations/0007_bootstrap_draftchangelog.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0007_bootstrap_draftchangelog.py rename to src/openedx_content/backcompat/publishing/migrations/0007_bootstrap_draftchangelog.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0008_alter_draftchangelogrecord_options_and_more.py b/src/openedx_content/backcompat/publishing/migrations/0008_alter_draftchangelogrecord_options_and_more.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0008_alter_draftchangelogrecord_options_and_more.py rename to src/openedx_content/backcompat/publishing/migrations/0008_alter_draftchangelogrecord_options_and_more.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0009_dependencies_and_hashing.py b/src/openedx_content/backcompat/publishing/migrations/0009_dependencies_and_hashing.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0009_dependencies_and_hashing.py rename to src/openedx_content/backcompat/publishing/migrations/0009_dependencies_and_hashing.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py b/src/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py similarity index 99% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py rename to src/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py index c6a64c490..19d9ed61f 100644 --- a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py +++ b/src/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py @@ -17,7 +17,7 @@ from django.db import migrations from django.db.models import F, Prefetch -from openedx_learning.lib.fields import create_hash_digest +from openedx_django_lib.fields import create_hash_digest def create_backfill(apps, schema_editor): diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0011_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/publishing/migrations/0011_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/0011_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/publishing/migrations/0011_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/contents/migrations/__init__.py b/src/openedx_content/backcompat/publishing/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/contents/migrations/__init__.py rename to src/openedx_content/backcompat/publishing/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/models.py b/src/openedx_content/backcompat/publishing/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/models.py rename to src/openedx_content/backcompat/publishing/models.py diff --git a/openedx_learning/apps/openedx_content/backcompat/readme.rst b/src/openedx_content/backcompat/readme.rst similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/readme.rst rename to src/openedx_content/backcompat/readme.rst diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/__init__.py b/src/openedx_content/backcompat/sections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/__init__.py rename to src/openedx_content/backcompat/sections/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/sections/apps.py b/src/openedx_content/backcompat/sections/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/sections/apps.py rename to src/openedx_content/backcompat/sections/apps.py index 35a922773..897da4606 100644 --- a/openedx_learning/apps/openedx_content/backcompat/sections/apps.py +++ b/src/openedx_content/backcompat/sections/apps.py @@ -10,7 +10,7 @@ class SectionsConfig(AppConfig): Configuration for the Sections Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.sections" + name = "openedx_content.backcompat.sections" verbose_name = "Learning Core > Authoring > Sections" default_auto_field = "django.db.models.BigAutoField" label = "oel_sections" diff --git a/openedx_learning/apps/openedx_content/backcompat/sections/migrations/0001_initial.py b/src/openedx_content/backcompat/sections/migrations/0001_initial.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/sections/migrations/0001_initial.py rename to src/openedx_content/backcompat/sections/migrations/0001_initial.py diff --git a/openedx_learning/apps/openedx_content/backcompat/sections/migrations/0002_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/sections/migrations/0002_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/sections/migrations/0002_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/sections/migrations/0002_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/publishing/migrations/__init__.py b/src/openedx_content/backcompat/sections/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/publishing/migrations/__init__.py rename to src/openedx_content/backcompat/sections/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/sections/__init__.py b/src/openedx_content/backcompat/subsections/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/sections/__init__.py rename to src/openedx_content/backcompat/subsections/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/subsections/apps.py b/src/openedx_content/backcompat/subsections/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/subsections/apps.py rename to src/openedx_content/backcompat/subsections/apps.py index a0f946b96..2341011a1 100644 --- a/openedx_learning/apps/openedx_content/backcompat/subsections/apps.py +++ b/src/openedx_content/backcompat/subsections/apps.py @@ -10,7 +10,7 @@ class SubsectionsConfig(AppConfig): Configuration for the subsections Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.subsections" + name = "openedx_content.backcompat.subsections" verbose_name = "Learning Core > Authoring > Subsections" default_auto_field = "django.db.models.BigAutoField" label = "oel_subsections" diff --git a/openedx_learning/apps/openedx_content/backcompat/subsections/migrations/0001_initial.py b/src/openedx_content/backcompat/subsections/migrations/0001_initial.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/subsections/migrations/0001_initial.py rename to src/openedx_content/backcompat/subsections/migrations/0001_initial.py diff --git a/openedx_learning/apps/openedx_content/backcompat/subsections/migrations/0002_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/subsections/migrations/0002_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/subsections/migrations/0002_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/subsections/migrations/0002_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/sections/migrations/__init__.py b/src/openedx_content/backcompat/subsections/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/sections/migrations/__init__.py rename to src/openedx_content/backcompat/subsections/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/subsections/__init__.py b/src/openedx_content/backcompat/units/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/subsections/__init__.py rename to src/openedx_content/backcompat/units/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/units/apps.py b/src/openedx_content/backcompat/units/apps.py similarity index 82% rename from openedx_learning/apps/openedx_content/backcompat/units/apps.py rename to src/openedx_content/backcompat/units/apps.py index 7296798f2..78d9a741d 100644 --- a/openedx_learning/apps/openedx_content/backcompat/units/apps.py +++ b/src/openedx_content/backcompat/units/apps.py @@ -10,7 +10,7 @@ class UnitsConfig(AppConfig): Configuration for the units Django application. """ - name = "openedx_learning.apps.openedx_content.backcompat.units" + name = "openedx_content.backcompat.units" verbose_name = "Learning Core > Authoring > Units" default_auto_field = "django.db.models.BigAutoField" label = "oel_units" diff --git a/openedx_learning/apps/openedx_content/backcompat/units/migrations/0001_initial.py b/src/openedx_content/backcompat/units/migrations/0001_initial.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/units/migrations/0001_initial.py rename to src/openedx_content/backcompat/units/migrations/0001_initial.py diff --git a/openedx_learning/apps/openedx_content/backcompat/units/migrations/0002_remove_all_field_state_for_move_to_applet.py b/src/openedx_content/backcompat/units/migrations/0002_remove_all_field_state_for_move_to_applet.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/units/migrations/0002_remove_all_field_state_for_move_to_applet.py rename to src/openedx_content/backcompat/units/migrations/0002_remove_all_field_state_for_move_to_applet.py diff --git a/openedx_learning/apps/openedx_content/backcompat/subsections/migrations/__init__.py b/src/openedx_content/backcompat/units/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/subsections/migrations/__init__.py rename to src/openedx_content/backcompat/units/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/units/__init__.py b/src/openedx_content/management/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/units/__init__.py rename to src/openedx_content/management/__init__.py diff --git a/openedx_learning/apps/openedx_content/backcompat/units/migrations/__init__.py b/src/openedx_content/management/commands/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/backcompat/units/migrations/__init__.py rename to src/openedx_content/management/commands/__init__.py diff --git a/openedx_learning/apps/openedx_content/management/commands/add_assets_to_component.py b/src/openedx_content/management/commands/add_assets_to_component.py similarity index 100% rename from openedx_learning/apps/openedx_content/management/commands/add_assets_to_component.py rename to src/openedx_content/management/commands/add_assets_to_component.py diff --git a/openedx_learning/apps/openedx_content/management/commands/lp_dump.py b/src/openedx_content/management/commands/lp_dump.py similarity index 92% rename from openedx_learning/apps/openedx_content/management/commands/lp_dump.py rename to src/openedx_content/management/commands/lp_dump.py index dc20fd083..c23038b2d 100644 --- a/openedx_learning/apps/openedx_content/management/commands/lp_dump.py +++ b/src/openedx_content/management/commands/lp_dump.py @@ -8,8 +8,8 @@ from django.core.management import CommandError from django.core.management.base import BaseCommand -from openedx_learning.apps.openedx_content.applets.backup_restore.api import create_zip_file -from openedx_learning.apps.openedx_content.applets.publishing.api import LearningPackage +from openedx_content.applets.backup_restore.api import create_zip_file +from openedx_content.applets.publishing.api import LearningPackage logger = logging.getLogger(__name__) diff --git a/openedx_learning/apps/openedx_content/management/commands/lp_load.py b/src/openedx_content/management/commands/lp_load.py similarity index 95% rename from openedx_learning/apps/openedx_content/management/commands/lp_load.py rename to src/openedx_content/management/commands/lp_load.py index f658db390..97fc55870 100644 --- a/openedx_learning/apps/openedx_content/management/commands/lp_load.py +++ b/src/openedx_content/management/commands/lp_load.py @@ -8,7 +8,7 @@ from django.core.management import CommandError from django.core.management.base import BaseCommand -from openedx_learning.apps.openedx_content.applets.backup_restore.api import load_learning_package +from openedx_content.applets.backup_restore.api import load_learning_package logger = logging.getLogger(__name__) diff --git a/openedx_learning/apps/openedx_content/migrations/0001_initial.py b/src/openedx_content/migrations/0001_initial.py similarity index 90% rename from openedx_learning/apps/openedx_content/migrations/0001_initial.py rename to src/openedx_content/migrations/0001_initial.py index 843062532..c81b3d8e5 100644 --- a/openedx_learning/apps/openedx_content/migrations/0001_initial.py +++ b/src/openedx_content/migrations/0001_initial.py @@ -13,8 +13,8 @@ from django.db import migrations, models from django.db.migrations.operations.special import SeparateDatabaseAndState -import openedx_learning.lib.fields -import openedx_learning.lib.validators +import openedx_django_lib.fields +import openedx_django_lib.validators class Migration(migrations.Migration): @@ -41,8 +41,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('can_stand_alone', models.BooleanField(default=True, help_text='Set to True when created independently, False when created as part of a container.')), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ], @@ -56,8 +56,8 @@ class Migration(migrations.Migration): name='ComponentType', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('namespace', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), - ('name', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), + ('namespace', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), + ('name', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=100)), ], options={ 'db_table': 'oel_components_componenttype', @@ -68,9 +68,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('title', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), + ('title', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), ('version_num', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1)])), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('entity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='openedx_content.publishableentity')), ], @@ -87,8 +87,8 @@ class Migration(migrations.Migration): ('size', models.PositiveBigIntegerField(validators=[django.core.validators.MaxValueValidator(50000000)])), ('hash_digest', models.CharField(editable=False, max_length=40)), ('has_file', models.BooleanField()), - ('text', openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=50000, null=True)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('text', openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=50000, null=True)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ], options={ 'verbose_name': 'Content', @@ -110,11 +110,11 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), - ('title', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=500)), - ('description', openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=10000)), - ('created', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), - ('updated', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), + ('title', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=500)), + ('description', openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=10000)), + ('created', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), + ('updated', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ], options={ 'verbose_name': 'Learning Package', @@ -126,9 +126,9 @@ class Migration(migrations.Migration): name='MediaType', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('type', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), - ('sub_type', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), - ('suffix', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('type', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('sub_type', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), + ('suffix', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=127)), ], options={ 'db_table': "oel_contents_mediatype", @@ -148,8 +148,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('message', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), - ('published_at', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('message', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', max_length=500)), + ('published_at', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ], options={ 'verbose_name': 'Publish Log', @@ -184,12 +184,12 @@ class Migration(migrations.Migration): name='Collection', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), - ('title', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='The title of the collection.', max_length=500)), - ('description', openedx_learning.lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', help_text='Provides extra information for the user about this collection.', max_length=10000)), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), + ('title', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='The title of the collection.', max_length=500)), + ('description', openedx_django_lib.fields.MultiCollationTextField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, default='', help_text='Provides extra information for the user about this collection.', max_length=10000)), ('enabled', models.BooleanField(default=True, help_text='Disabled collections are "soft deleted", and should be re-enabled before use, or be deleted.')), - ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_learning.lib.validators.validate_utc_datetime])), - ('modified', models.DateTimeField(auto_now=True, validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_django_lib.validators.validate_utc_datetime])), + ('modified', models.DateTimeField(auto_now=True, validators=[openedx_django_lib.validators.validate_utc_datetime])), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ], options={ @@ -201,7 +201,7 @@ class Migration(migrations.Migration): name='Component', fields=[ ('publishable_entity', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='openedx_content.publishableentity')), - ('local_key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), + ('local_key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), ], options={ 'verbose_name': 'Component', @@ -242,7 +242,7 @@ class Migration(migrations.Migration): name='CollectionPublishableEntity', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('created', models.DateTimeField(auto_now_add=True, validators=[openedx_django_lib.validators.validate_utc_datetime])), ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openedx_content.collection')), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('entity', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='openedx_content.publishableentity')), @@ -280,7 +280,7 @@ class Migration(migrations.Migration): name='ComponentVersionContent', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), + ('key', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500)), ('content', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='openedx_content.content')), ], options={ @@ -292,7 +292,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')), - ('changed_at', models.DateTimeField(validators=[openedx_learning.lib.validators.validate_utc_datetime])), + ('changed_at', models.DateTimeField(validators=[openedx_django_lib.validators.validate_utc_datetime])), ('changed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ], options={ diff --git a/openedx_learning/apps/openedx_content/migrations/0002_rename_tables_to_openedx_content.py b/src/openedx_content/migrations/0002_rename_tables_to_openedx_content.py similarity index 100% rename from openedx_learning/apps/openedx_content/migrations/0002_rename_tables_to_openedx_content.py rename to src/openedx_content/migrations/0002_rename_tables_to_openedx_content.py diff --git a/openedx_learning/apps/openedx_content/management/__init__.py b/src/openedx_content/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/management/__init__.py rename to src/openedx_content/migrations/__init__.py diff --git a/openedx_learning/apps/openedx_content/models.py b/src/openedx_content/models.py similarity index 100% rename from openedx_learning/apps/openedx_content/models.py rename to src/openedx_content/models.py diff --git a/openedx_learning/api/authoring_models.py b/src/openedx_content/models_api.py similarity index 50% rename from openedx_learning/api/authoring_models.py rename to src/openedx_content/models_api.py index 25c90eeb3..195554a32 100644 --- a/openedx_learning/api/authoring_models.py +++ b/src/openedx_content/models_api.py @@ -7,10 +7,10 @@ """ # These wildcard imports are okay because these modules declare __all__. # pylint: disable=wildcard-import -from ..apps.openedx_content.applets.collections.models import * -from ..apps.openedx_content.applets.components.models import * -from ..apps.openedx_content.applets.contents.models import * -from ..apps.openedx_content.applets.publishing.models import * -from ..apps.openedx_content.applets.sections.models import * -from ..apps.openedx_content.applets.subsections.models import * -from ..apps.openedx_content.applets.units.models import * +from .applets.collections.models import * +from .applets.components.models import * +from .applets.contents.models import * +from .applets.publishing.models import * +from .applets.sections.models import * +from .applets.subsections.models import * +from .applets.units.models import * diff --git a/src/openedx_content/settings_api.py b/src/openedx_content/settings_api.py new file mode 100644 index 000000000..558aa0682 --- /dev/null +++ b/src/openedx_content/settings_api.py @@ -0,0 +1,41 @@ +""" +Special openedx_content API for use in Django settings modules. + +In order to be usable at Django startup, this must not import any models, +which is why it is defined separately from api.py +""" + + +def openedx_content_backcompat_apps_to_install(): + """ + Return list of Django apps to add to INSTALLED_APPS for backwards compatibility. + + Version 0.31.0 of openedx-core (nee openedx-learning) reorganized its installation profile + from many Django apps within `openedx_learning.apps.authoring` into a single `openedx_content` + Django app. For backwards compatibility, anything that installed this package prior to 0.31.0 + should install the apps returned by this function, in addition to installing `openedx_content` + itself. + + Example:: + + from openedx_content.api import openedx_content_backcompat_apps_to_install + INSTALLED_APPS = [ + ..., + "openedx_content", + *openedx_content_backcompat_apps_to_install(), + ..., + ] + + Eventually, when we are confident all clients have run data migrations, this function will just + return an empty list. + """ + return [ + "openedx_content.backcompat.backup_restore", + "openedx_content.backcompat.collections", + "openedx_content.backcompat.components", + "openedx_content.backcompat.contents", + "openedx_content.backcompat.publishing", + "openedx_content.backcompat.sections", + "openedx_content.backcompat.subsections", + "openedx_content.backcompat.units", + ] diff --git a/src/openedx_core/__init__.py b/src/openedx_core/__init__.py new file mode 100644 index 000000000..9dda0f5cc --- /dev/null +++ b/src/openedx_core/__init__.py @@ -0,0 +1,9 @@ +""" +Metadata for the openedx-core repository and its PyPI package. + +There is currently no public API for openedx_core--that's intentional! +The public APIs belong to the specific apps (openedx_content, openedx_tagging, etc.). +""" + +# The version for the entire repository +__version__ = "0.32.0" diff --git a/src/openedx_django_lib/__init__.py b/src/openedx_django_lib/__init__.py new file mode 100644 index 000000000..534bb5045 --- /dev/null +++ b/src/openedx_django_lib/__init__.py @@ -0,0 +1,6 @@ +""" +Utilities, to be used within this repository only. These are *not* public APIs. + +If any of these need to be used outside the repository, they can be factored into something +like edx-django-utils. +""" diff --git a/openedx_learning/lib/admin_utils.py b/src/openedx_django_lib/admin_utils.py similarity index 100% rename from openedx_learning/lib/admin_utils.py rename to src/openedx_django_lib/admin_utils.py diff --git a/openedx_learning/lib/collations.py b/src/openedx_django_lib/collations.py similarity index 100% rename from openedx_learning/lib/collations.py rename to src/openedx_django_lib/collations.py diff --git a/openedx_learning/lib/fields.py b/src/openedx_django_lib/fields.py similarity index 100% rename from openedx_learning/lib/fields.py rename to src/openedx_django_lib/fields.py diff --git a/openedx_learning/lib/managers.py b/src/openedx_django_lib/managers.py similarity index 100% rename from openedx_learning/lib/managers.py rename to src/openedx_django_lib/managers.py diff --git a/openedx_learning/lib/validators.py b/src/openedx_django_lib/validators.py similarity index 100% rename from openedx_learning/lib/validators.py rename to src/openedx_django_lib/validators.py diff --git a/openedx_learning/apps/openedx_content/management/commands/__init__.py b/src/openedx_tagging/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/management/commands/__init__.py rename to src/openedx_tagging/__init__.py diff --git a/openedx_tagging/core/tagging/admin.py b/src/openedx_tagging/admin.py similarity index 100% rename from openedx_tagging/core/tagging/admin.py rename to src/openedx_tagging/admin.py diff --git a/openedx_tagging/core/tagging/api.py b/src/openedx_tagging/api.py similarity index 100% rename from openedx_tagging/core/tagging/api.py rename to src/openedx_tagging/api.py diff --git a/openedx_tagging/core/tagging/apps.py b/src/openedx_tagging/apps.py similarity index 59% rename from openedx_tagging/core/tagging/apps.py rename to src/openedx_tagging/apps.py index d5877dfee..5e1192c80 100644 --- a/openedx_tagging/core/tagging/apps.py +++ b/src/openedx_tagging/apps.py @@ -10,7 +10,10 @@ class TaggingConfig(AppConfig): Configuration for the tagging Django application. """ - name = "openedx_tagging.core.tagging" - verbose_name = "Tagging" + name = "openedx_tagging" + verbose_name = "Open edX Core > Tagging" default_auto_field = "django.db.models.BigAutoField" + + # Historical note: "oel" comes from "Open edX Learning", the original + # name of this apps's repository. label = "oel_tagging" diff --git a/openedx_tagging/core/tagging/data.py b/src/openedx_tagging/data.py similarity index 100% rename from openedx_tagging/core/tagging/data.py rename to src/openedx_tagging/data.py diff --git a/openedx_tagging/core/tagging/import_export/__init__.py b/src/openedx_tagging/import_export/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/__init__.py rename to src/openedx_tagging/import_export/__init__.py diff --git a/openedx_tagging/core/tagging/import_export/actions.py b/src/openedx_tagging/import_export/actions.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/actions.py rename to src/openedx_tagging/import_export/actions.py diff --git a/openedx_tagging/core/tagging/import_export/api.py b/src/openedx_tagging/import_export/api.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/api.py rename to src/openedx_tagging/import_export/api.py diff --git a/openedx_tagging/core/tagging/import_export/exceptions.py b/src/openedx_tagging/import_export/exceptions.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/exceptions.py rename to src/openedx_tagging/import_export/exceptions.py diff --git a/openedx_tagging/core/tagging/import_export/import_plan.py b/src/openedx_tagging/import_export/import_plan.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/import_plan.py rename to src/openedx_tagging/import_export/import_plan.py diff --git a/openedx_tagging/core/tagging/import_export/parsers.py b/src/openedx_tagging/import_export/parsers.py similarity index 100% rename from openedx_tagging/core/tagging/import_export/parsers.py rename to src/openedx_tagging/import_export/parsers.py diff --git a/openedx_tagging/core/tagging/import_export/tasks.py b/src/openedx_tagging/import_export/tasks.py similarity index 91% rename from openedx_tagging/core/tagging/import_export/tasks.py rename to src/openedx_tagging/import_export/tasks.py index 3a79ab5ca..21e394f86 100644 --- a/openedx_tagging/core/tagging/import_export/tasks.py +++ b/src/openedx_tagging/import_export/tasks.py @@ -7,7 +7,7 @@ from celery import shared_task # type: ignore[import] -import openedx_tagging.core.tagging.import_export.api as import_export_api +import openedx_tagging.import_export.api as import_export_api from ..models import Taxonomy from .import_plan import TagImportPlan, TagImportTask diff --git a/openedx_tagging/core/tagging/import_export/template.csv b/src/openedx_tagging/import_export/template.csv similarity index 100% rename from openedx_tagging/core/tagging/import_export/template.csv rename to src/openedx_tagging/import_export/template.csv diff --git a/openedx_tagging/core/tagging/import_export/template.json b/src/openedx_tagging/import_export/template.json similarity index 100% rename from openedx_tagging/core/tagging/import_export/template.json rename to src/openedx_tagging/import_export/template.json diff --git a/openedx_tagging/core/tagging/migrations/0001_initial.py b/src/openedx_tagging/migrations/0001_initial.py similarity index 92% rename from openedx_tagging/core/tagging/migrations/0001_initial.py rename to src/openedx_tagging/migrations/0001_initial.py index 1599f8769..7bf4701ae 100644 --- a/openedx_tagging/core/tagging/migrations/0001_initial.py +++ b/src/openedx_tagging/migrations/0001_initial.py @@ -3,7 +3,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ("id", models.BigAutoField(primary_key=True, serialize=False)), ( "name", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", @@ -30,7 +30,7 @@ class Migration(migrations.Migration): ), ( "description", - openedx_learning.lib.fields.MultiCollationTextField( + openedx_django_lib.fields.MultiCollationTextField( blank=True, help_text="Provides extra information for the user when applying tags from this taxonomy to an object.", null=True, @@ -75,7 +75,7 @@ class Migration(migrations.Migration): ("id", models.BigAutoField(primary_key=True, serialize=False)), ( "value", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", @@ -86,7 +86,7 @@ class Migration(migrations.Migration): ), ( "external_id", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( blank=True, db_collations={ "mysql": "utf8mb4_unicode_ci", @@ -126,7 +126,7 @@ class Migration(migrations.Migration): ("id", models.BigAutoField(primary_key=True, serialize=False)), ( "object_id", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", @@ -137,7 +137,7 @@ class Migration(migrations.Migration): ), ( "object_type", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", @@ -148,7 +148,7 @@ class Migration(migrations.Migration): ), ( "_name", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", @@ -159,7 +159,7 @@ class Migration(migrations.Migration): ), ( "_value", - openedx_learning.lib.fields.MultiCollationCharField( + openedx_django_lib.fields.MultiCollationCharField( db_collations={ "mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE", diff --git a/openedx_tagging/core/tagging/migrations/0001_squashed.py b/src/openedx_tagging/migrations/0001_squashed.py similarity index 72% rename from openedx_tagging/core/tagging/migrations/0001_squashed.py rename to src/openedx_tagging/migrations/0001_squashed.py index e4ee96cf9..56ef5d05e 100644 --- a/openedx_tagging/core/tagging/migrations/0001_squashed.py +++ b/src/openedx_tagging/migrations/0001_squashed.py @@ -3,8 +3,8 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields -import openedx_tagging.core.tagging.models.import_export +import openedx_django_lib.fields +import openedx_tagging.models.import_export class Migration(migrations.Migration): @@ -34,8 +34,8 @@ class Migration(migrations.Migration): name='Taxonomy', fields=[ ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('name', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, db_index=True, help_text='User-facing label used when applying tags from this taxonomy to Open edX objects.', max_length=255)), - ('description', openedx_learning.lib.fields.MultiCollationTextField(blank=True, help_text='Provides extra information for the user when applying tags from this taxonomy to an object.')), + ('name', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, db_index=True, help_text='User-facing label used when applying tags from this taxonomy to Open edX objects.', max_length=255)), + ('description', openedx_django_lib.fields.MultiCollationTextField(blank=True, help_text='Provides extra information for the user when applying tags from this taxonomy to an object.')), ('enabled', models.BooleanField(default=True, help_text='Only enabled taxonomies will be shown to authors.')), ('allow_multiple', models.BooleanField(default=True, help_text='Indicates that multiple tags from this taxonomy may be added to an object.')), ('allow_free_text', models.BooleanField(default=False, help_text='Indicates that tags in this taxonomy need not be predefined; authors may enter their own tag values.')), @@ -51,7 +51,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.BigAutoField(primary_key=True, serialize=False)), ('log', models.TextField(blank=True, default=None, help_text='Action execution logs')), - ('status', models.CharField(choices=[(openedx_tagging.core.tagging.models.import_export.TagImportTaskState['LOADING_DATA'], 'loading_data'), (openedx_tagging.core.tagging.models.import_export.TagImportTaskState['PLANNING'], 'planning'), (openedx_tagging.core.tagging.models.import_export.TagImportTaskState['EXECUTING'], 'executing'), (openedx_tagging.core.tagging.models.import_export.TagImportTaskState['SUCCESS'], 'success'), (openedx_tagging.core.tagging.models.import_export.TagImportTaskState['ERROR'], 'error')], help_text='Task status', max_length=20)), + ('status', models.CharField(choices=[(openedx_tagging.models.import_export.TagImportTaskState['LOADING_DATA'], 'loading_data'), (openedx_tagging.models.import_export.TagImportTaskState['PLANNING'], 'planning'), (openedx_tagging.models.import_export.TagImportTaskState['EXECUTING'], 'executing'), (openedx_tagging.models.import_export.TagImportTaskState['SUCCESS'], 'success'), (openedx_tagging.models.import_export.TagImportTaskState['ERROR'], 'error')], help_text='Task status', max_length=20)), ('creation_date', models.DateTimeField(auto_now_add=True)), ('taxonomy', models.ForeignKey(help_text='Taxonomy associated with this import', on_delete=django.db.models.deletion.CASCADE, to='oel_tagging.taxonomy')), ], @@ -60,8 +60,8 @@ class Migration(migrations.Migration): name='Tag', fields=[ ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('value', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text="Content of a given tag, occupying the 'value' part of the key:value pair.", max_length=500)), - ('external_id', openedx_learning.lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='Used to link an Open edX Tag with a tag in an externally-defined taxonomy.', max_length=255, null=True)), + ('value', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text="Content of a given tag, occupying the 'value' part of the key:value pair.", max_length=500)), + ('external_id', openedx_django_lib.fields.MultiCollationCharField(blank=True, db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='Used to link an Open edX Tag with a tag in an externally-defined taxonomy.', max_length=255, null=True)), ('parent', models.ForeignKey(default=None, help_text='Tag that lives one level up from the current tag, forming a hierarchy.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='oel_tagging.tag')), ('taxonomy', models.ForeignKey(default=None, help_text='Namespace and rules for using a given set of tags.', null=True, on_delete=django.db.models.deletion.CASCADE, to='oel_tagging.taxonomy')), ], @@ -70,9 +70,9 @@ class Migration(migrations.Migration): name='ObjectTag', fields=[ ('id', models.BigAutoField(primary_key=True, serialize=False)), - ('object_id', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_index=True, editable=False, help_text='Identifier for the object being tagged', max_length=255)), - ('_name', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing label used for this tag, stored in case taxonomy is (or becomes) null. If the taxonomy field is set, then taxonomy.name takes precedence over this field.', max_length=255)), - ('_value', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing value used for this tag, stored in case tag is null, e.g if taxonomy is free text, or if it becomes null (e.g. if the Tag is deleted). If the tag field is set, then tag.value takes precedence over this field.', max_length=500)), + ('object_id', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_index=True, editable=False, help_text='Identifier for the object being tagged', max_length=255)), + ('_name', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing label used for this tag, stored in case taxonomy is (or becomes) null. If the taxonomy field is set, then taxonomy.name takes precedence over this field.', max_length=255)), + ('_value', openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing value used for this tag, stored in case tag is null, e.g if taxonomy is free text, or if it becomes null (e.g. if the Tag is deleted). If the tag field is set, then tag.value takes precedence over this field.', max_length=500)), ('tag', models.ForeignKey(blank=True, default=None, help_text="Tag associated with this object tag. Provides the tag's 'value' if set.", null=True, on_delete=django.db.models.deletion.SET_NULL, to='oel_tagging.tag')), ('taxonomy', models.ForeignKey(default=None, help_text="Taxonomy that this object tag belongs to. Used for validating the tag and provides the tag's 'name' if set.", null=True, on_delete=django.db.models.deletion.SET_NULL, to='oel_tagging.taxonomy')), ], diff --git a/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py b/src/openedx_tagging/migrations/0002_auto_20230718_2026.py similarity index 96% rename from openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py rename to src/openedx_tagging/migrations/0002_auto_20230718_2026.py index d0d14c938..9fc440516 100644 --- a/openedx_tagging/core/tagging/migrations/0002_auto_20230718_2026.py +++ b/src/openedx_tagging/migrations/0002_auto_20230718_2026.py @@ -3,7 +3,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -69,7 +69,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="objecttag", name="object_id", - field=openedx_learning.lib.fields.MultiCollationCharField( + field=openedx_django_lib.fields.MultiCollationCharField( db_collations={"mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE"}, editable=False, help_text="Identifier for the object being tagged", diff --git a/openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py b/src/openedx_tagging/migrations/0003_auto_20230721_1238.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0003_auto_20230721_1238.py rename to src/openedx_tagging/migrations/0003_auto_20230721_1238.py diff --git a/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py b/src/openedx_tagging/migrations/0004_auto_20230723_2001.py similarity index 90% rename from openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py rename to src/openedx_tagging/migrations/0004_auto_20230723_2001.py index c96e05209..4be6534ea 100644 --- a/openedx_tagging/core/tagging/migrations/0004_auto_20230723_2001.py +++ b/src/openedx_tagging/migrations/0004_auto_20230723_2001.py @@ -2,7 +2,7 @@ from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="objecttag", name="object_id", - field=openedx_learning.lib.fields.MultiCollationCharField( + field=openedx_django_lib.fields.MultiCollationCharField( db_collations={"mysql": "utf8mb4_unicode_ci", "sqlite": "NOCASE"}, db_index=True, editable=False, diff --git a/openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py b/src/openedx_tagging/migrations/0005_language_taxonomy.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0005_language_taxonomy.py rename to src/openedx_tagging/migrations/0005_language_taxonomy.py diff --git a/openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py b/src/openedx_tagging/migrations/0006_alter_objecttag_unique_together.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0006_alter_objecttag_unique_together.py rename to src/openedx_tagging/migrations/0006_alter_objecttag_unique_together.py diff --git a/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py b/src/openedx_tagging/migrations/0006_auto_20230802_1631.py similarity index 81% rename from openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py rename to src/openedx_tagging/migrations/0006_auto_20230802_1631.py index 1bb738545..d79742eab 100644 --- a/openedx_tagging/core/tagging/migrations/0006_auto_20230802_1631.py +++ b/src/openedx_tagging/migrations/0006_auto_20230802_1631.py @@ -3,7 +3,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_tagging.core.tagging.models.import_export +import openedx_tagging.models.import_export class Migration(migrations.Migration): @@ -27,31 +27,31 @@ class Migration(migrations.Migration): models.CharField( choices=[ ( - openedx_tagging.core.tagging.models.import_export.TagImportTaskState[ + openedx_tagging.models.import_export.TagImportTaskState[ "LOADING_DATA" ], "loading_data", ), ( - openedx_tagging.core.tagging.models.import_export.TagImportTaskState[ + openedx_tagging.models.import_export.TagImportTaskState[ "PLANNING" ], "planning", ), ( - openedx_tagging.core.tagging.models.import_export.TagImportTaskState[ + openedx_tagging.models.import_export.TagImportTaskState[ "EXECUTING" ], "executing", ), ( - openedx_tagging.core.tagging.models.import_export.TagImportTaskState[ + openedx_tagging.models.import_export.TagImportTaskState[ "SUCCESS" ], "success", ), ( - openedx_tagging.core.tagging.models.import_export.TagImportTaskState[ + openedx_tagging.models.import_export.TagImportTaskState[ "ERROR" ], "error", diff --git a/openedx_tagging/core/tagging/migrations/0007_tag_import_task_log_null_fix.py b/src/openedx_tagging/migrations/0007_tag_import_task_log_null_fix.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0007_tag_import_task_log_null_fix.py rename to src/openedx_tagging/migrations/0007_tag_import_task_log_null_fix.py diff --git a/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py b/src/openedx_tagging/migrations/0008_taxonomy_description_not_null.py similarity index 84% rename from openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py rename to src/openedx_tagging/migrations/0008_taxonomy_description_not_null.py index 73da9320b..5aca15618 100644 --- a/openedx_tagging/core/tagging/migrations/0008_taxonomy_description_not_null.py +++ b/src/openedx_tagging/migrations/0008_taxonomy_description_not_null.py @@ -2,7 +2,7 @@ from django.db import migrations -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="taxonomy", name="description", - field=openedx_learning.lib.fields.MultiCollationTextField( + field=openedx_django_lib.fields.MultiCollationTextField( blank=True, default="", help_text="Provides extra information for the user when applying tags from this taxonomy to an object.", diff --git a/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py b/src/openedx_tagging/migrations/0009_alter_objecttag_object_id.py similarity index 56% rename from openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py rename to src/openedx_tagging/migrations/0009_alter_objecttag_object_id.py index 9e1150b27..058d129bb 100644 --- a/openedx_tagging/core/tagging/migrations/0009_alter_objecttag_object_id.py +++ b/src/openedx_tagging/migrations/0009_alter_objecttag_object_id.py @@ -2,7 +2,7 @@ from django.db import migrations -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='objecttag', name='object_id', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_index=True, editable=False, help_text='Identifier for the object being tagged', max_length=255), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_index=True, editable=False, help_text='Identifier for the object being tagged', max_length=255), ), ] diff --git a/openedx_tagging/core/tagging/migrations/0010_cleanups.py b/src/openedx_tagging/migrations/0010_cleanups.py similarity index 96% rename from openedx_tagging/core/tagging/migrations/0010_cleanups.py rename to src/openedx_tagging/migrations/0010_cleanups.py index 35b74a2d1..2c27c0699 100644 --- a/openedx_tagging/core/tagging/migrations/0010_cleanups.py +++ b/src/openedx_tagging/migrations/0010_cleanups.py @@ -3,7 +3,7 @@ import django.db.models.expressions from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields class Migration(migrations.Migration): diff --git a/openedx_tagging/core/tagging/migrations/0011_remove_required.py b/src/openedx_tagging/migrations/0011_remove_required.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0011_remove_required.py rename to src/openedx_tagging/migrations/0011_remove_required.py diff --git a/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py b/src/openedx_tagging/migrations/0012_language_taxonomy.py similarity index 92% rename from openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py rename to src/openedx_tagging/migrations/0012_language_taxonomy.py index 132fcaaeb..30f38a0cb 100644 --- a/openedx_tagging/core/tagging/migrations/0012_language_taxonomy.py +++ b/src/openedx_tagging/migrations/0012_language_taxonomy.py @@ -18,7 +18,7 @@ def create_language_taxonomy(apps, schema_editor): "allow_multiple": False, "allow_free_text": False, "visible_to_authors": True, - "_taxonomy_class": "openedx_tagging.core.tagging.models.system_defined.LanguageTaxonomy", + "_taxonomy_class": "openedx_tagging.models.system_defined.LanguageTaxonomy", }) # But delete any unused tags created by the old fixture: diff --git a/openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py b/src/openedx_tagging/migrations/0013_tag_parent_blank.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0013_tag_parent_blank.py rename to src/openedx_tagging/migrations/0013_tag_parent_blank.py diff --git a/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py b/src/openedx_tagging/migrations/0014_minor_fixes.py similarity index 91% rename from openedx_tagging/core/tagging/migrations/0014_minor_fixes.py rename to src/openedx_tagging/migrations/0014_minor_fixes.py index e09177899..caf0a3832 100644 --- a/openedx_tagging/core/tagging/migrations/0014_minor_fixes.py +++ b/src/openedx_tagging/migrations/0014_minor_fixes.py @@ -2,7 +2,7 @@ from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields def fix_language_taxonomy(apps, schema_editor): @@ -12,7 +12,7 @@ def fix_language_taxonomy(apps, schema_editor): without the right taxonomy_class. """ Taxonomy = apps.get_model("oel_tagging", "Taxonomy") - correct_class = "openedx_tagging.core.tagging.models.system_defined.LanguageTaxonomy" + correct_class = "openedx_tagging.models.system_defined.LanguageTaxonomy" lang_taxonomy = Taxonomy.objects.get(pk=-1) if lang_taxonomy._taxonomy_class != correct_class: lang_taxonomy._taxonomy_class = correct_class diff --git a/openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py b/src/openedx_tagging/migrations/0015_taxonomy_export_id.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0015_taxonomy_export_id.py rename to src/openedx_tagging/migrations/0015_taxonomy_export_id.py diff --git a/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py b/src/openedx_tagging/migrations/0016_object_tag_export_id.py similarity index 84% rename from openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py rename to src/openedx_tagging/migrations/0016_object_tag_export_id.py index 671cf1a35..4da906518 100644 --- a/openedx_tagging/core/tagging/migrations/0016_object_tag_export_id.py +++ b/src/openedx_tagging/migrations/0016_object_tag_export_id.py @@ -3,7 +3,7 @@ import django.db.models.deletion from django.db import migrations, models -import openedx_learning.lib.fields +import openedx_django_lib.fields def migrate_export_id(apps, schema_editor): @@ -56,7 +56,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='objecttag', name='_export_id', - field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing label used for this tag, stored in case taxonomy is (or becomes) null. If the taxonomy field is set, then taxonomy.export_id takes precedence over this field.', max_length=255), + field=openedx_django_lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, help_text='User-facing label used for this tag, stored in case taxonomy is (or becomes) null. If the taxonomy field is set, then taxonomy.export_id takes precedence over this field.', max_length=255), ), migrations.RunPython(migrate_language_export_id, reverse_language_export_id), ] diff --git a/openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py b/src/openedx_tagging/migrations/0017_alter_tagimporttask_status.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0017_alter_tagimporttask_status.py rename to src/openedx_tagging/migrations/0017_alter_tagimporttask_status.py diff --git a/openedx_tagging/core/tagging/migrations/0018_objecttag_is_copied.py b/src/openedx_tagging/migrations/0018_objecttag_is_copied.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/0018_objecttag_is_copied.py rename to src/openedx_tagging/migrations/0018_objecttag_is_copied.py diff --git a/openedx_learning/apps/openedx_content/migrations/__init__.py b/src/openedx_tagging/migrations/__init__.py similarity index 100% rename from openedx_learning/apps/openedx_content/migrations/__init__.py rename to src/openedx_tagging/migrations/__init__.py diff --git a/openedx_tagging/core/tagging/models/__init__.py b/src/openedx_tagging/models/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/models/__init__.py rename to src/openedx_tagging/models/__init__.py diff --git a/openedx_tagging/core/tagging/models/base.py b/src/openedx_tagging/models/base.py similarity index 99% rename from openedx_tagging/core/tagging/models/base.py rename to src/openedx_tagging/models/base.py index d8b27bdd4..668ba73e3 100644 --- a/openedx_tagging/core/tagging/models/base.py +++ b/src/openedx_tagging/models/base.py @@ -16,7 +16,7 @@ from django.utils.translation import gettext_lazy as _ from typing_extensions import Self # Until we upgrade to python 3.11 -from openedx_learning.lib.fields import MultiCollationTextField, case_insensitive_char_field, case_sensitive_char_field +from openedx_django_lib.fields import MultiCollationTextField, case_insensitive_char_field, case_sensitive_char_field from ..data import TagDataQuerySet from .utils import RESERVED_TAG_CHARS, ConcatNull diff --git a/openedx_tagging/core/tagging/models/import_export.py b/src/openedx_tagging/models/import_export.py similarity index 100% rename from openedx_tagging/core/tagging/models/import_export.py rename to src/openedx_tagging/models/import_export.py diff --git a/openedx_tagging/core/tagging/models/system_defined.py b/src/openedx_tagging/models/system_defined.py similarity index 99% rename from openedx_tagging/core/tagging/models/system_defined.py rename to src/openedx_tagging/models/system_defined.py index 3efb68f22..370af3c5c 100644 --- a/openedx_tagging/core/tagging/models/system_defined.py +++ b/src/openedx_tagging/models/system_defined.py @@ -10,7 +10,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.db import models -from openedx_tagging.core.tagging.models.base import Tag +from openedx_tagging.models.base import Tag from .base import Tag, Taxonomy diff --git a/openedx_tagging/core/tagging/models/utils.py b/src/openedx_tagging/models/utils.py similarity index 100% rename from openedx_tagging/core/tagging/models/utils.py rename to src/openedx_tagging/models/utils.py diff --git a/openedx_learning/py.typed b/src/openedx_tagging/py.typed similarity index 100% rename from openedx_learning/py.typed rename to src/openedx_tagging/py.typed diff --git a/openedx_tagging/core/tagging/readme.rst b/src/openedx_tagging/readme.rst similarity index 100% rename from openedx_tagging/core/tagging/readme.rst rename to src/openedx_tagging/readme.rst diff --git a/openedx_learning/contrib/__init__.py b/src/openedx_tagging/rest_api/__init__.py similarity index 100% rename from openedx_learning/contrib/__init__.py rename to src/openedx_tagging/rest_api/__init__.py diff --git a/openedx_tagging/core/tagging/rest_api/paginators.py b/src/openedx_tagging/rest_api/paginators.py similarity index 97% rename from openedx_tagging/core/tagging/rest_api/paginators.py rename to src/openedx_tagging/rest_api/paginators.py index 5831e8b01..c1f16c3b8 100644 --- a/openedx_tagging/core/tagging/rest_api/paginators.py +++ b/src/openedx_tagging/rest_api/paginators.py @@ -7,7 +7,7 @@ from rest_framework.request import Request from rest_framework.response import Response -from openedx_tagging.core.tagging.models import Tag, Taxonomy +from openedx_tagging.models import Tag, Taxonomy from .utils import UserPermissionsHelper diff --git a/openedx_tagging/core/tagging/rest_api/urls.py b/src/openedx_tagging/rest_api/urls.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/urls.py rename to src/openedx_tagging/rest_api/urls.py diff --git a/openedx_tagging/core/tagging/rest_api/utils.py b/src/openedx_tagging/rest_api/utils.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/utils.py rename to src/openedx_tagging/rest_api/utils.py diff --git a/openedx_learning/lib/__init__.py b/src/openedx_tagging/rest_api/v1/__init__.py similarity index 100% rename from openedx_learning/lib/__init__.py rename to src/openedx_tagging/rest_api/v1/__init__.py diff --git a/openedx_tagging/core/tagging/rest_api/v1/permissions.py b/src/openedx_tagging/rest_api/v1/permissions.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/v1/permissions.py rename to src/openedx_tagging/rest_api/v1/permissions.py diff --git a/openedx_tagging/core/tagging/rest_api/v1/serializers.py b/src/openedx_tagging/rest_api/v1/serializers.py similarity index 97% rename from openedx_tagging/core/tagging/rest_api/v1/serializers.py rename to src/openedx_tagging/rest_api/v1/serializers.py index 46f614f3f..761e0b141 100644 --- a/openedx_tagging/core/tagging/rest_api/v1/serializers.py +++ b/src/openedx_tagging/rest_api/v1/serializers.py @@ -10,10 +10,10 @@ from rest_framework.request import Request from rest_framework.reverse import reverse -from openedx_tagging.core.tagging.data import TagData -from openedx_tagging.core.tagging.import_export.parsers import ParserFormat -from openedx_tagging.core.tagging.models import ObjectTag, Tag, TagImportTask, Taxonomy -from openedx_tagging.core.tagging.rules import ObjectTagPermissionItem +from openedx_tagging.data import TagData +from openedx_tagging.import_export.parsers import ParserFormat +from openedx_tagging.models import ObjectTag, Tag, TagImportTask, Taxonomy +from openedx_tagging.rules import ObjectTagPermissionItem from ..utils import UserPermissionsHelper diff --git a/openedx_tagging/core/tagging/rest_api/v1/urls.py b/src/openedx_tagging/rest_api/v1/urls.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/v1/urls.py rename to src/openedx_tagging/rest_api/v1/urls.py diff --git a/openedx_tagging/core/tagging/rest_api/v1/views.py b/src/openedx_tagging/rest_api/v1/views.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/v1/views.py rename to src/openedx_tagging/rest_api/v1/views.py diff --git a/openedx_tagging/core/tagging/rest_api/v1/views_import.py b/src/openedx_tagging/rest_api/v1/views_import.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/v1/views_import.py rename to src/openedx_tagging/rest_api/v1/views_import.py diff --git a/openedx_tagging/core/tagging/rules.py b/src/openedx_tagging/rules.py similarity index 100% rename from openedx_tagging/core/tagging/rules.py rename to src/openedx_tagging/rules.py diff --git a/openedx_tagging/core/tagging/urls.py b/src/openedx_tagging/urls.py similarity index 100% rename from openedx_tagging/core/tagging/urls.py rename to src/openedx_tagging/urls.py diff --git a/test_settings.py b/test_settings.py index 73c97bc47..b1df13adf 100644 --- a/test_settings.py +++ b/test_settings.py @@ -7,7 +7,7 @@ from os.path import abspath, dirname, join -from openedx_learning.api.django import openedx_learning_apps_to_install +from openedx_content.settings_api import openedx_content_backcompat_apps_to_install def root(*args): @@ -53,8 +53,9 @@ def root(*args): # django-rules based authorization 'rules.apps.AutodiscoverRulesConfig', # Our own apps - *openedx_learning_apps_to_install(), - "openedx_tagging.core.tagging", + "openedx_tagging", + "openedx_content", + *openedx_content_backcompat_apps_to_install(), ] AUTHENTICATION_BACKENDS = [ @@ -62,7 +63,7 @@ def root(*args): ] LOCALE_PATHS = [ - root("openedx_learning", "conf", "locale"), + root("conf", "locale"), ] ROOT_URLCONF = "projects.urls" @@ -73,14 +74,14 @@ def root(*args): MEDIA_ROOT = root("test_media") -######################### Django Rest Framework ######################## +# ========================= Django Rest Framework ======================== REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'edx_rest_framework_extensions.paginators.DefaultPagination', 'PAGE_SIZE': 10, } -######################## LEARNING CORE SETTINGS ######################## +# ========================= LEARNING CORE SETTINGS ======================== OPENEDX_LEARNING = { 'MEDIA': { diff --git a/test_utils/zip_file_utils.py b/test_utils/zip_file_utils.py index 96a7a8f42..31dc4c589 100644 --- a/test_utils/zip_file_utils.py +++ b/test_utils/zip_file_utils.py @@ -7,7 +7,7 @@ def folder_to_inmemory_zip(folder_path: str) -> zipfile.ZipFile: """ - Reads the contents of a folder and returns an in-memory ZipFile object. + Read the contents of a folder and returns an in-memory ZipFile object. Args: folder_path (str): Path to the folder to zip. diff --git a/openedx_tagging/core/__init__.py b/tests/openedx_content/__init__.py similarity index 100% rename from openedx_tagging/core/__init__.py rename to tests/openedx_content/__init__.py diff --git a/openedx_tagging/core/tagging/__init__.py b/tests/openedx_content/applets/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/__init__.py rename to tests/openedx_content/applets/__init__.py diff --git a/openedx_tagging/core/tagging/migrations/__init__.py b/tests/openedx_content/applets/backup_restore/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/migrations/__init__.py rename to tests/openedx_content/applets/backup_restore/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/collections/collection-test.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/collections/collection-test.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/collections/collection-test.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/collections/collection-test.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/section1-8ca126.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/section1-8ca126.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/section1-8ca126.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/section1-8ca126.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/subsection1-48afa3.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/subsection1-48afa3.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/subsection1-48afa3.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/subsection1-48afa3.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/unit1-b7eafb.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/unit1-b7eafb.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/unit1-b7eafb.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/unit1-b7eafb.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27/component_versions/v2/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27/component_versions/v2/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27/component_versions/v2/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/drag-and-drop-v2/4d1b2fac-8b30-42fb-872d-6b10ab580b27/component_versions/v2/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2/component_versions/v2/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2/component_versions/v2/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2/component_versions/v2/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/c22b9f97-f1e9-4e8f-87f0-d5a3c26083e2/component_versions/v2/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/static/me.png b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/static/me.png similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/static/me.png rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v4/static/me.png diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/static/me.png b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/static/me.png similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/static/me.png rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/html/e32d5479-9492-41f6-9222-550a7346bc37/component_versions/v5/static/me.png diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53/component_versions/v2/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53/component_versions/v2/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53/component_versions/v2/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/openassessment/1ee38208-a585-4455-a27e-4930aa541f53/component_versions/v2/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b/component_versions/v2/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b/component_versions/v2/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b/component_versions/v2/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/problem/256739e8-c2df-4ced-bd10-8156f6cfa90b/component_versions/v2/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471/component_versions/v1/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471/component_versions/v1/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471/component_versions/v1/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/survey/6681da3f-b056-4c6e-a8f9-040967907471/component_versions/v1/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568/component_versions/v3/block.xml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568/component_versions/v3/block.xml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568/component_versions/v3/block.xml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/entities/xblock.v1/video/22601ebd-9da8-430b-9778-cfe059a98568/component_versions/v3/block.xml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/package.toml b/tests/openedx_content/applets/backup_restore/fixtures/library_backup/package.toml similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/fixtures/library_backup/package.toml rename to tests/openedx_content/applets/backup_restore/fixtures/library_backup/package.toml diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_backup.py b/tests/openedx_content/applets/backup_restore/test_backup.py similarity index 97% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/test_backup.py rename to tests/openedx_content/applets/backup_restore/test_backup.py index ba11d93ed..f3d753f29 100644 --- a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_backup.py +++ b/tests/openedx_content/applets/backup_restore/test_backup.py @@ -9,11 +9,11 @@ from django.contrib.auth import get_user_model from django.core.management import CommandError, call_command from django.db.models import QuerySet +from django.test import TestCase -from openedx_learning.api import authoring as api -from openedx_learning.api.authoring_models import Collection, Component, Content, LearningPackage, PublishableEntity -from openedx_learning.apps.openedx_content.applets.backup_restore.zipper import LearningPackageZipper -from openedx_learning.lib.test_utils import TestCase +from openedx_content import api +from openedx_content.applets.backup_restore.zipper import LearningPackageZipper +from openedx_content.models_api import Collection, Component, Content, LearningPackage, PublishableEntity User = get_user_model() diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_restore.py b/tests/openedx_content/applets/backup_restore/test_restore.py similarity index 95% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/test_restore.py rename to tests/openedx_content/applets/backup_restore/test_restore.py index 07436b174..6d334fafa 100644 --- a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_restore.py +++ b/tests/openedx_content/applets/backup_restore/test_restore.py @@ -6,15 +6,12 @@ from django.contrib.auth import get_user_model from django.core.management import call_command +from django.test import TestCase -from openedx_learning.apps.openedx_content.applets.backup_restore.zipper import ( - LearningPackageUnzipper, - generate_staged_lp_key, -) -from openedx_learning.apps.openedx_content.applets.collections import api as collections_api -from openedx_learning.apps.openedx_content.applets.components import api as components_api -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api -from openedx_learning.lib.test_utils import TestCase +from openedx_content.applets.backup_restore.zipper import LearningPackageUnzipper, generate_staged_lp_key +from openedx_content.applets.collections import api as collections_api +from openedx_content.applets.components import api as components_api +from openedx_content.applets.publishing import api as publishing_api from test_utils.zip_file_utils import folder_to_inmemory_zip User = get_user_model() @@ -34,7 +31,7 @@ def setUp(self): class RestoreLearningPackageCommandTest(RestoreTestCase): """Tests for the lp_load management command.""" - @patch("openedx_learning.apps.openedx_content.applets.backup_restore.api.load_learning_package") + @patch("openedx_content.applets.backup_restore.api.load_learning_package") def test_restore_command(self, mock_load_learning_package): # Mock load_learning_package to return our in-memory zip file restore_result = LearningPackageUnzipper(self.zip_file, user=self.user).load() @@ -287,7 +284,7 @@ def test_error_learning_package_missing_key(self): # Mock parse_learning_package_toml to return a dict without 'key' with patch( - "openedx_learning.apps.openedx_content.applets.backup_restore.zipper.parse_learning_package_toml", + "openedx_content.applets.backup_restore.zipper.parse_learning_package_toml", return_value={ "learning_package": { "title": "Library test", @@ -318,7 +315,7 @@ def test_error_no_metadata_section(self): # Mock parse_learning_package_toml to return a dict without 'meta' with patch( - "openedx_learning.apps.openedx_content.applets.backup_restore.zipper.parse_learning_package_toml", + "openedx_content.applets.backup_restore.zipper.parse_learning_package_toml", return_value={ "learning_package": { "title": "Library test", diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_slug_hash.py b/tests/openedx_content/applets/backup_restore/test_slug_hash.py similarity index 95% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/test_slug_hash.py rename to tests/openedx_content/applets/backup_restore/test_slug_hash.py index 582510488..fa9712aea 100644 --- a/tests/openedx_learning/apps/authoring/applets/backup_restore/test_slug_hash.py +++ b/tests/openedx_content/applets/backup_restore/test_slug_hash.py @@ -5,8 +5,9 @@ generating slugified, hash-based filenames. """ -from openedx_learning.apps.openedx_content.applets.backup_restore.zipper import slugify_hashed_filename -from openedx_learning.lib.test_utils import TestCase +from django.test import TestCase + +from openedx_content.applets.backup_restore.zipper import slugify_hashed_filename class SlugHashTestCase(TestCase): diff --git a/openedx_tagging/core/tagging/rest_api/__init__.py b/tests/openedx_content/applets/collections/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/__init__.py rename to tests/openedx_content/applets/collections/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/collections/test_api.py b/tests/openedx_content/applets/collections/test_api.py similarity index 99% rename from tests/openedx_learning/apps/authoring/applets/collections/test_api.py rename to tests/openedx_content/applets/collections/test_api.py index 97b2f2ba4..faf6352aa 100644 --- a/tests/openedx_learning/apps/authoring/applets/collections/test_api.py +++ b/tests/openedx_content/applets/collections/test_api.py @@ -6,11 +6,12 @@ from django.contrib.auth import get_user_model from django.contrib.auth.models import User as UserType # pylint: disable=imported-auth-user from django.core.exceptions import ObjectDoesNotExist, ValidationError +from django.test import TestCase from freezegun import freeze_time # Ensure our APIs and models are all exported to the package API. -from openedx_learning.api import authoring as api -from openedx_learning.api.authoring_models import ( +from openedx_content import api +from openedx_content.models_api import ( Collection, CollectionPublishableEntity, Component, @@ -19,7 +20,6 @@ PublishableEntity, Unit, ) -from openedx_learning.lib.test_utils import TestCase User = get_user_model() diff --git a/openedx_tagging/core/tagging/rest_api/v1/__init__.py b/tests/openedx_content/applets/components/__init__.py similarity index 100% rename from openedx_tagging/core/tagging/rest_api/v1/__init__.py rename to tests/openedx_content/applets/components/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/components/test_api.py b/tests/openedx_content/applets/components/test_api.py similarity index 96% rename from tests/openedx_learning/apps/authoring/applets/components/test_api.py rename to tests/openedx_content/applets/components/test_api.py index 851a4e755..13bc5c1b2 100644 --- a/tests/openedx_learning/apps/authoring/applets/components/test_api.py +++ b/tests/openedx_content/applets/components/test_api.py @@ -6,16 +6,16 @@ from django.contrib.auth import get_user_model from django.contrib.auth.models import User as UserType # pylint: disable=imported-auth-user from django.core.exceptions import ObjectDoesNotExist - -from openedx_learning.apps.openedx_content.applets.collections import api as collection_api -from openedx_learning.apps.openedx_content.applets.collections.models import Collection -from openedx_learning.apps.openedx_content.applets.components import api as components_api -from openedx_learning.apps.openedx_content.applets.components.models import Component, ComponentType -from openedx_learning.apps.openedx_content.applets.contents import api as contents_api -from openedx_learning.apps.openedx_content.applets.contents.models import MediaType -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api -from openedx_learning.apps.openedx_content.applets.publishing.models import LearningPackage -from openedx_learning.lib.test_utils import TestCase +from django.test import TestCase + +from openedx_content.applets.collections import api as collection_api +from openedx_content.applets.collections.models import Collection +from openedx_content.applets.components import api as components_api +from openedx_content.applets.components.models import Component, ComponentType +from openedx_content.applets.contents import api as contents_api +from openedx_content.applets.contents.models import MediaType +from openedx_content.applets.publishing import api as publishing_api +from openedx_content.applets.publishing.models import LearningPackage User = get_user_model() diff --git a/tests/openedx_learning/apps/authoring/applets/components/test_assets.py b/tests/openedx_content/applets/components/test_assets.py similarity index 93% rename from tests/openedx_learning/apps/authoring/applets/components/test_assets.py rename to tests/openedx_content/applets/components/test_assets.py index 8132263d4..45cfa2ad0 100644 --- a/tests/openedx_learning/apps/authoring/applets/components/test_assets.py +++ b/tests/openedx_content/applets/components/test_assets.py @@ -5,12 +5,13 @@ from pathlib import Path from uuid import uuid4 -from openedx_learning.apps.openedx_content.applets.components import api as components_api -from openedx_learning.apps.openedx_content.applets.components.api import AssetError -from openedx_learning.apps.openedx_content.applets.contents import api as contents_api -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api -from openedx_learning.apps.openedx_content.applets.publishing.models import LearningPackage -from openedx_learning.lib.test_utils import TestCase +from django.test import TestCase + +from openedx_content.applets.components import api as components_api +from openedx_content.applets.components.api import AssetError +from openedx_content.applets.contents import api as contents_api +from openedx_content.applets.publishing import api as publishing_api +from openedx_content.applets.publishing.models import LearningPackage class AssetTestCase(TestCase): diff --git a/tests/openedx_learning/apps/authoring/applets/components/test_models.py b/tests/openedx_content/applets/components/test_models.py similarity index 94% rename from tests/openedx_learning/apps/authoring/applets/components/test_models.py rename to tests/openedx_content/applets/components/test_models.py index 9562920da..356346a6a 100644 --- a/tests/openedx_learning/apps/authoring/applets/components/test_models.py +++ b/tests/openedx_content/applets/components/test_models.py @@ -4,21 +4,21 @@ from datetime import datetime, timezone from typing import TYPE_CHECKING, assert_type +from django.test import TestCase from freezegun import freeze_time -from openedx_learning.apps.openedx_content.applets.components.api import ( +from openedx_content.applets.components.api import ( create_component_and_version, get_component, get_or_create_component_type, ) -from openedx_learning.apps.openedx_content.applets.components.models import Component, ComponentType, ComponentVersion -from openedx_learning.apps.openedx_content.applets.publishing.api import ( +from openedx_content.applets.components.models import Component, ComponentType, ComponentVersion +from openedx_content.applets.publishing.api import ( LearningPackage, create_learning_package, create_publishable_entity_version, publish_all_drafts, ) -from openedx_learning.lib.test_utils import TestCase if TYPE_CHECKING: # Test that our mixins on Component.objects and PublishableEntityVersionMixin etc. haven't broken manager typing diff --git a/tests/openedx_learning/__init__.py b/tests/openedx_content/applets/contents/__init__.py similarity index 100% rename from tests/openedx_learning/__init__.py rename to tests/openedx_content/applets/contents/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/contents/test_file_storage.py b/tests/openedx_content/applets/contents/test_file_storage.py similarity index 89% rename from tests/openedx_learning/apps/authoring/applets/contents/test_file_storage.py rename to tests/openedx_content/applets/contents/test_file_storage.py index 5d38c3bb6..90d017aa4 100644 --- a/tests/openedx_learning/apps/authoring/applets/contents/test_file_storage.py +++ b/tests/openedx_content/applets/contents/test_file_storage.py @@ -5,12 +5,11 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.test import override_settings +from django.test import TestCase, override_settings -from openedx_learning.apps.openedx_content.applets.contents import api as contents_api -from openedx_learning.apps.openedx_content.applets.contents.models import get_storage -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api -from openedx_learning.lib.test_utils import TestCase +from openedx_content.applets.contents import api as contents_api +from openedx_content.applets.contents.models import get_storage +from openedx_content.applets.publishing import api as publishing_api class ContentFileStorageTestCase(TestCase): diff --git a/tests/openedx_learning/apps/authoring/applets/contents/test_media_types.py b/tests/openedx_content/applets/contents/test_media_types.py similarity index 85% rename from tests/openedx_learning/apps/authoring/applets/contents/test_media_types.py rename to tests/openedx_content/applets/contents/test_media_types.py index 4e439c46e..a08b6b449 100644 --- a/tests/openedx_learning/apps/authoring/applets/contents/test_media_types.py +++ b/tests/openedx_content/applets/contents/test_media_types.py @@ -1,8 +1,9 @@ """ A few tests to make sure our MediaType lookups are working as expected. """ -from openedx_learning.apps.openedx_content.applets.contents import api as contents_api -from openedx_learning.lib.test_utils import TestCase +from django.test import TestCase + +from openedx_content.applets.contents import api as contents_api class MediaTypeTest(TestCase): diff --git a/tests/openedx_learning/apps/__init__.py b/tests/openedx_content/applets/publishing/__init__.py similarity index 100% rename from tests/openedx_learning/apps/__init__.py rename to tests/openedx_content/applets/publishing/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/publishing/test_api.py b/tests/openedx_content/applets/publishing/test_api.py similarity index 99% rename from tests/openedx_learning/apps/authoring/applets/publishing/test_api.py rename to tests/openedx_content/applets/publishing/test_api.py index ee4a54f7b..c0f113787 100644 --- a/tests/openedx_learning/apps/authoring/applets/publishing/test_api.py +++ b/tests/openedx_content/applets/publishing/test_api.py @@ -9,9 +9,10 @@ import pytest from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError +from django.test import TestCase -from openedx_learning.apps.openedx_content.applets.publishing import api as publishing_api -from openedx_learning.apps.openedx_content.applets.publishing.models import ( +from openedx_content.applets.publishing import api as publishing_api +from openedx_content.applets.publishing.models import ( Container, ContainerVersion, Draft, @@ -22,7 +23,6 @@ PublishableEntity, PublishLog, ) -from openedx_learning.lib.test_utils import TestCase User = get_user_model() diff --git a/tests/openedx_learning/apps/authoring/applets/publishing/test_models.py b/tests/openedx_content/applets/publishing/test_models.py similarity index 74% rename from tests/openedx_learning/apps/authoring/applets/publishing/test_models.py rename to tests/openedx_content/applets/publishing/test_models.py index 254f312a3..0a924fba9 100644 --- a/tests/openedx_learning/apps/authoring/applets/publishing/test_models.py +++ b/tests/openedx_content/applets/publishing/test_models.py @@ -3,11 +3,8 @@ """ from typing import TYPE_CHECKING, assert_type -from openedx_learning.apps.openedx_content.applets.publishing.models import ( - PublishableEntityMixin, - PublishableEntityVersionMixin, -) -from openedx_learning.lib.managers import WithRelationsManager +from openedx_content.applets.publishing.models import PublishableEntityMixin, PublishableEntityVersionMixin +from openedx_django_lib.managers import WithRelationsManager if TYPE_CHECKING: # Test that our mixins provide the right typing for 'objects' diff --git a/tests/openedx_learning/apps/authoring/__init__.py b/tests/openedx_content/applets/sections/__init__.py similarity index 100% rename from tests/openedx_learning/apps/authoring/__init__.py rename to tests/openedx_content/applets/sections/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/sections/test_api.py b/tests/openedx_content/applets/sections/test_api.py similarity index 99% rename from tests/openedx_learning/apps/authoring/applets/sections/test_api.py rename to tests/openedx_content/applets/sections/test_api.py index 9ac496735..435d6e8ec 100644 --- a/tests/openedx_learning/apps/authoring/applets/sections/test_api.py +++ b/tests/openedx_content/applets/sections/test_api.py @@ -5,8 +5,8 @@ import pytest from django.core.exceptions import ValidationError -from openedx_learning.api import authoring as authoring_api -from openedx_learning.api import authoring_models +import openedx_content.api as authoring_api +from openedx_content import models_api as authoring_models from ..subsections.test_api import SubSectionTestCase diff --git a/tests/openedx_learning/apps/authoring/applets/__init__.py b/tests/openedx_content/applets/subsections/__init__.py similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/__init__.py rename to tests/openedx_content/applets/subsections/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/subsections/test_api.py b/tests/openedx_content/applets/subsections/test_api.py similarity index 99% rename from tests/openedx_learning/apps/authoring/applets/subsections/test_api.py rename to tests/openedx_content/applets/subsections/test_api.py index 5af38c33c..5ea59c205 100644 --- a/tests/openedx_learning/apps/authoring/applets/subsections/test_api.py +++ b/tests/openedx_content/applets/subsections/test_api.py @@ -8,8 +8,8 @@ from django.core.exceptions import ValidationError from django.db import IntegrityError -from openedx_learning.api import authoring as authoring_api -from openedx_learning.api import authoring_models +import openedx_content.api as authoring_api +from openedx_content import models_api as authoring_models from ..units.test_api import UnitTestCase @@ -262,7 +262,7 @@ def test_adding_external_units(self): created_by=None, ) - @patch('openedx_learning.apps.openedx_content.applets.subsections.api._pub_entities_for_units') + @patch('openedx_content.applets.subsections.api._pub_entities_for_units') def test_adding_mismatched_versions(self, mock_entities_for_units): # pylint: disable=arguments-renamed """ Test that versioned units must match their entities. diff --git a/tests/openedx_learning/apps/authoring/applets/backup_restore/__init__.py b/tests/openedx_content/applets/units/__init__.py similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/backup_restore/__init__.py rename to tests/openedx_content/applets/units/__init__.py diff --git a/tests/openedx_learning/apps/authoring/applets/units/test_api.py b/tests/openedx_content/applets/units/test_api.py similarity index 99% rename from tests/openedx_learning/apps/authoring/applets/units/test_api.py rename to tests/openedx_content/applets/units/test_api.py index 2f908e1b8..560e2e719 100644 --- a/tests/openedx_learning/apps/authoring/applets/units/test_api.py +++ b/tests/openedx_content/applets/units/test_api.py @@ -8,8 +8,8 @@ from django.core.exceptions import ValidationError from django.db import IntegrityError -from openedx_learning.api import authoring as authoring_api -from openedx_learning.api import authoring_models +import openedx_content.api as authoring_api +from openedx_content import models_api as authoring_models from ..components.test_api import ComponentTestCase @@ -250,7 +250,7 @@ def test_adding_external_components(self): created_by=None, ) - @patch('openedx_learning.apps.openedx_content.applets.units.api._pub_entities_for_components') + @patch('openedx_content.applets.units.api._pub_entities_for_components') def test_adding_mismatched_versions(self, mock_entities_for_components): """ Test that versioned components must match their entities. diff --git a/tests/openedx_learning/apps/authoring/applets/components/__init__.py b/tests/openedx_learning/apps/authoring/applets/components/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_learning/apps/authoring/applets/contents/__init__.py b/tests/openedx_learning/apps/authoring/applets/contents/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_learning/apps/authoring/applets/publishing/__init__.py b/tests/openedx_learning/apps/authoring/applets/publishing/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_learning/apps/authoring/applets/sections/__init__.py b/tests/openedx_learning/apps/authoring/applets/sections/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_learning/apps/authoring/applets/subsections/__init__.py b/tests/openedx_learning/apps/authoring/applets/subsections/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_learning/apps/authoring/applets/units/__init__.py b/tests/openedx_learning/apps/authoring/applets/units/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_tagging/core/__init__.py b/tests/openedx_tagging/core/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_tagging/core/tagging/__init__.py b/tests/openedx_tagging/core/tagging/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_tagging/core/tagging/import_export/__init__.py b/tests/openedx_tagging/core/tagging/import_export/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/openedx_tagging/core/fixtures/tagging.yaml b/tests/openedx_tagging/fixtures/tagging.yaml similarity index 96% rename from tests/openedx_tagging/core/fixtures/tagging.yaml rename to tests/openedx_tagging/fixtures/tagging.yaml index 8f0700299..6608ef8f2 100644 --- a/tests/openedx_tagging/core/fixtures/tagging.yaml +++ b/tests/openedx_tagging/fixtures/tagging.yaml @@ -240,7 +240,7 @@ allow_multiple: false allow_free_text: false export_id: user_authors - _taxonomy_class: openedx_tagging.core.tagging.models.system_defined.UserSystemDefinedTaxonomy + _taxonomy_class: openedx_tagging.models.system_defined.UserSystemDefinedTaxonomy - model: oel_tagging.taxonomy pk: 4 fields: @@ -250,7 +250,7 @@ allow_multiple: true allow_free_text: false export_id: system_defined_taxonomy - _taxonomy_class: openedx_tagging.core.tagging.models.system_defined.SystemDefinedTaxonomy + _taxonomy_class: openedx_tagging.models.system_defined.SystemDefinedTaxonomy - model: oel_tagging.taxonomy pk: 5 fields: diff --git a/tests/openedx_learning/apps/authoring/applets/collections/__init__.py b/tests/openedx_tagging/import_export/__init__.py similarity index 100% rename from tests/openedx_learning/apps/authoring/applets/collections/__init__.py rename to tests/openedx_tagging/import_export/__init__.py diff --git a/tests/openedx_tagging/core/tagging/import_export/mixins.py b/tests/openedx_tagging/import_export/mixins.py similarity index 68% rename from tests/openedx_tagging/core/tagging/import_export/mixins.py rename to tests/openedx_tagging/import_export/mixins.py index 045d3c180..1832b4f16 100644 --- a/tests/openedx_tagging/core/tagging/import_export/mixins.py +++ b/tests/openedx_tagging/import_export/mixins.py @@ -1,7 +1,7 @@ """ Mixins for ImportExport tests """ -from openedx_tagging.core.tagging.models import Taxonomy +from openedx_tagging.models import Taxonomy class TestImportExportMixin: @@ -9,7 +9,7 @@ class TestImportExportMixin: Mixin that loads the base data for import/export tests """ - fixtures = ["tests/openedx_tagging/core/fixtures/tagging.yaml"] + fixtures = ["tests/openedx_tagging/fixtures/tagging.yaml"] def setUp(self): self.taxonomy = Taxonomy.objects.get(name="Import Taxonomy Test") diff --git a/tests/openedx_tagging/core/tagging/import_export/test_actions.py b/tests/openedx_tagging/import_export/test_actions.py similarity index 98% rename from tests/openedx_tagging/core/tagging/import_export/test_actions.py rename to tests/openedx_tagging/import_export/test_actions.py index cd3aec60c..189756c53 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_actions.py +++ b/tests/openedx_tagging/import_export/test_actions.py @@ -6,7 +6,7 @@ import ddt # type: ignore[import] from django.test.testcases import TestCase -from openedx_tagging.core.tagging.import_export.actions import ( +from openedx_tagging.import_export.actions import ( CreateTag, DeleteTag, ImportAction, @@ -14,8 +14,8 @@ UpdateParentTag, WithoutChanges, ) -from openedx_tagging.core.tagging.import_export.import_plan import TagItem -from openedx_tagging.core.tagging.models import Tag +from openedx_tagging.import_export.import_plan import TagItem +from openedx_tagging.models import Tag from .mixins import TestImportExportMixin diff --git a/tests/openedx_tagging/core/tagging/import_export/test_api.py b/tests/openedx_tagging/import_export/test_api.py similarity index 97% rename from tests/openedx_tagging/core/tagging/import_export/test_api.py rename to tests/openedx_tagging/import_export/test_api.py index 441587c45..d9b1c541a 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_api.py +++ b/tests/openedx_tagging/import_export/test_api.py @@ -6,9 +6,9 @@ from django.test.testcases import TestCase -import openedx_tagging.core.tagging.import_export.api as import_export_api -from openedx_tagging.core.tagging.import_export import ParserFormat -from openedx_tagging.core.tagging.models import LanguageTaxonomy, Tag, TagImportTask, TagImportTaskState, Taxonomy +import openedx_tagging.import_export.api as import_export_api +from openedx_tagging.import_export import ParserFormat +from openedx_tagging.models import LanguageTaxonomy, Tag, TagImportTask, TagImportTaskState, Taxonomy from .mixins import TestImportExportMixin diff --git a/tests/openedx_tagging/core/tagging/import_export/test_import_plan.py b/tests/openedx_tagging/import_export/test_import_plan.py similarity index 98% rename from tests/openedx_tagging/core/tagging/import_export/test_import_plan.py rename to tests/openedx_tagging/import_export/test_import_plan.py index 2e158748a..88f24a8b2 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_import_plan.py +++ b/tests/openedx_tagging/import_export/test_import_plan.py @@ -4,9 +4,9 @@ import ddt # type: ignore[import] from django.test.testcases import TestCase -from openedx_tagging.core.tagging.import_export.actions import CreateTag -from openedx_tagging.core.tagging.import_export.exceptions import TagImportError -from openedx_tagging.core.tagging.import_export.import_plan import TagImportPlan, TagItem +from openedx_tagging.import_export.actions import CreateTag +from openedx_tagging.import_export.exceptions import TagImportError +from openedx_tagging.import_export.import_plan import TagImportPlan, TagItem from .test_actions import TestImportActionMixin diff --git a/tests/openedx_tagging/core/tagging/import_export/test_parsers.py b/tests/openedx_tagging/import_export/test_parsers.py similarity index 97% rename from tests/openedx_tagging/core/tagging/import_export/test_parsers.py rename to tests/openedx_tagging/import_export/test_parsers.py index 52a75afa1..bdb07ccc9 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_parsers.py +++ b/tests/openedx_tagging/import_export/test_parsers.py @@ -9,9 +9,9 @@ import ddt # type: ignore[import] from django.test.testcases import TestCase -from openedx_tagging.core.tagging.import_export.exceptions import TagParserError -from openedx_tagging.core.tagging.import_export.parsers import CSVParser, JSONParser, Parser, ParserFormat, get_parser -from openedx_tagging.core.tagging.models import Taxonomy +from openedx_tagging.import_export.exceptions import TagParserError +from openedx_tagging.import_export.parsers import CSVParser, JSONParser, Parser, ParserFormat, get_parser +from openedx_tagging.models import Taxonomy from .mixins import TestImportExportMixin diff --git a/tests/openedx_tagging/core/tagging/import_export/test_tasks.py b/tests/openedx_tagging/import_export/test_tasks.py similarity index 76% rename from tests/openedx_tagging/core/tagging/import_export/test_tasks.py rename to tests/openedx_tagging/import_export/test_tasks.py index 7091382fe..ade5a2f13 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_tasks.py +++ b/tests/openedx_tagging/import_export/test_tasks.py @@ -6,8 +6,8 @@ from django.test.testcases import TestCase -import openedx_tagging.core.tagging.import_export.tasks as import_export_tasks -from openedx_tagging.core.tagging.import_export import ParserFormat +import openedx_tagging.import_export.tasks as import_export_tasks +from openedx_tagging.import_export import ParserFormat from .mixins import TestImportExportMixin @@ -22,7 +22,7 @@ def test_import_tags_task(self): parser_format = ParserFormat.CSV replace = True - with patch('openedx_tagging.core.tagging.import_export.api.import_tags') as mock_import_tags: + with patch('openedx_tagging.import_export.api.import_tags') as mock_import_tags: mock_import_tags.return_value = (True, None, None) result, _result_task, _result_plan = import_export_tasks.import_tags_task( @@ -35,7 +35,7 @@ def test_import_tags_task(self): def test_export_tags_task(self): output_format = ParserFormat.JSON - with patch('openedx_tagging.core.tagging.import_export.api.export_tags') as mock_export_tags: + with patch('openedx_tagging.import_export.api.export_tags') as mock_export_tags: mock_export_tags.return_value = "exported_data" result = import_export_tasks.export_tags_task(self.taxonomy, output_format) diff --git a/tests/openedx_tagging/core/tagging/import_export/test_template.py b/tests/openedx_tagging/import_export/test_template.py similarity index 89% rename from tests/openedx_tagging/core/tagging/import_export/test_template.py rename to tests/openedx_tagging/import_export/test_template.py index 85621a72d..4a45f54ba 100644 --- a/tests/openedx_tagging/core/tagging/import_export/test_template.py +++ b/tests/openedx_tagging/import_export/test_template.py @@ -8,9 +8,9 @@ import ddt # type: ignore[import] from django.test.testcases import TestCase -from openedx_tagging.core.tagging.api import get_tags -from openedx_tagging.core.tagging.import_export import ParserFormat -from openedx_tagging.core.tagging.import_export import api as import_api +from openedx_tagging.api import get_tags +from openedx_tagging.import_export import ParserFormat +from openedx_tagging.import_export import api as import_api from ..utils import pretty_format_tags from .mixins import TestImportExportMixin @@ -29,14 +29,14 @@ def open_template_file(self, template_file): dirname = os.path.dirname(__file__) filename = os.path.join( dirname, - '../../../../..', + '../../..', template_file, ) return open(filename, "rb") @ddt.data( - ('openedx_tagging/core/tagging/import_export/template.csv', ParserFormat.CSV), - ('openedx_tagging/core/tagging/import_export/template.json', ParserFormat.JSON), + ('src/openedx_tagging/import_export/template.csv', ParserFormat.CSV), + ('src/openedx_tagging/import_export/template.json', ParserFormat.JSON), ) @ddt.unpack def test_import_template(self, template_file, parser_format): diff --git a/tests/openedx_tagging/core/tagging/test_api.py b/tests/openedx_tagging/test_api.py similarity index 99% rename from tests/openedx_tagging/core/tagging/test_api.py rename to tests/openedx_tagging/test_api.py index 25f57d968..aaa372b4b 100644 --- a/tests/openedx_tagging/core/tagging/test_api.py +++ b/tests/openedx_tagging/test_api.py @@ -9,8 +9,8 @@ import pytest from django.test import TestCase, override_settings -import openedx_tagging.core.tagging.api as tagging_api -from openedx_tagging.core.tagging.models import ObjectTag, Tag, Taxonomy +import openedx_tagging.api as tagging_api +from openedx_tagging.models import ObjectTag, Tag, Taxonomy from .test_models import TestTagTaxonomyMixin, get_tag from .utils import pretty_format_tags diff --git a/tests/openedx_tagging/core/tagging/test_models.py b/tests/openedx_tagging/test_models.py similarity index 99% rename from tests/openedx_tagging/core/tagging/test_models.py rename to tests/openedx_tagging/test_models.py index 9dbcdbde0..67ae68e2f 100644 --- a/tests/openedx_tagging/core/tagging/test_models.py +++ b/tests/openedx_tagging/test_models.py @@ -11,9 +11,9 @@ from django.db.utils import IntegrityError from django.test.testcases import TestCase -from openedx_tagging.core.tagging import api -from openedx_tagging.core.tagging.models import LanguageTaxonomy, ObjectTag, Tag, Taxonomy -from openedx_tagging.core.tagging.models.utils import RESERVED_TAG_CHARS +from openedx_tagging import api +from openedx_tagging.models import LanguageTaxonomy, ObjectTag, Tag, Taxonomy +from openedx_tagging.models.utils import RESERVED_TAG_CHARS from .utils import pretty_format_tags @@ -30,7 +30,7 @@ class TestTagTaxonomyMixin: Base class that uses the taxonomy fixture to load a base taxonomy and tags for testing. """ - fixtures = ["tests/openedx_tagging/core/fixtures/tagging.yaml"] + fixtures = ["tests/openedx_tagging/fixtures/tagging.yaml"] def setUp(self): super().setUp() diff --git a/tests/openedx_tagging/core/tagging/test_rules.py b/tests/openedx_tagging/test_rules.py similarity index 98% rename from tests/openedx_tagging/core/tagging/test_rules.py rename to tests/openedx_tagging/test_rules.py index 11cc2ced9..7e6cc7e02 100644 --- a/tests/openedx_tagging/core/tagging/test_rules.py +++ b/tests/openedx_tagging/test_rules.py @@ -6,8 +6,8 @@ from django.contrib.auth import get_user_model from django.test.testcases import TestCase -from openedx_tagging.core.tagging.models import ObjectTag -from openedx_tagging.core.tagging.rules import ObjectTagPermissionItem +from openedx_tagging.models import ObjectTag +from openedx_tagging.rules import ObjectTagPermissionItem from .test_models import TestTagTaxonomyMixin diff --git a/tests/openedx_tagging/core/tagging/test_system_defined_models.py b/tests/openedx_tagging/test_system_defined_models.py similarity index 97% rename from tests/openedx_tagging/core/tagging/test_system_defined_models.py rename to tests/openedx_tagging/test_system_defined_models.py index 5e519bfa9..dc58e7b8b 100644 --- a/tests/openedx_tagging/core/tagging/test_system_defined_models.py +++ b/tests/openedx_tagging/test_system_defined_models.py @@ -9,10 +9,10 @@ import pytest from django.test import TestCase, override_settings -from openedx_learning.apps.openedx_content.applets.publishing.models import LearningPackage -from openedx_tagging.core.tagging import api -from openedx_tagging.core.tagging.models import Taxonomy -from openedx_tagging.core.tagging.models.system_defined import ModelSystemDefinedTaxonomy, UserSystemDefinedTaxonomy +from openedx_content.applets.publishing.models import LearningPackage +from openedx_tagging import api +from openedx_tagging.models import Taxonomy +from openedx_tagging.models.system_defined import ModelSystemDefinedTaxonomy, UserSystemDefinedTaxonomy from .test_models import TestTagTaxonomyMixin diff --git a/tests/openedx_tagging/core/tagging/test_views.py b/tests/openedx_tagging/test_views.py similarity index 99% rename from tests/openedx_tagging/core/tagging/test_views.py rename to tests/openedx_tagging/test_views.py index 08ca9398f..67b975e06 100644 --- a/tests/openedx_tagging/core/tagging/test_views.py +++ b/tests/openedx_tagging/test_views.py @@ -13,13 +13,13 @@ from rest_framework import status from rest_framework.test import APITestCase -from openedx_tagging.core.tagging import api -from openedx_tagging.core.tagging.import_export import api as import_export_api -from openedx_tagging.core.tagging.import_export.parsers import ParserFormat -from openedx_tagging.core.tagging.models import ObjectTag, Tag, Taxonomy -from openedx_tagging.core.tagging.models.system_defined import SystemDefinedTaxonomy -from openedx_tagging.core.tagging.rest_api.paginators import TagsPagination -from openedx_tagging.core.tagging.rules import can_change_object_tag_objectid, can_view_object_tag_objectid +from openedx_tagging import api +from openedx_tagging.import_export import api as import_export_api +from openedx_tagging.import_export.parsers import ParserFormat +from openedx_tagging.models import ObjectTag, Tag, Taxonomy +from openedx_tagging.models.system_defined import SystemDefinedTaxonomy +from openedx_tagging.rest_api.paginators import TagsPagination +from openedx_tagging.rules import can_change_object_tag_objectid, can_view_object_tag_objectid from .test_models import TestTagTaxonomyMixin from .utils import pretty_format_tags @@ -1341,7 +1341,7 @@ class TestTaxonomyTagsView(TestTaxonomyViewMixin): Tests the list/create/update/delete tags of taxonomy view """ - fixtures = ["tests/openedx_tagging/core/fixtures/tagging.yaml"] + fixtures = ["tests/openedx_tagging/fixtures/tagging.yaml"] def setUp(self): self.small_taxonomy = Taxonomy.objects.get(name="Life on Earth") diff --git a/tests/openedx_tagging/core/tagging/test_views_import.py b/tests/openedx_tagging/test_views_import.py similarity index 100% rename from tests/openedx_tagging/core/tagging/test_views_import.py rename to tests/openedx_tagging/test_views_import.py diff --git a/tests/openedx_tagging/core/tagging/utils.py b/tests/openedx_tagging/utils.py similarity index 100% rename from tests/openedx_tagging/core/tagging/utils.py rename to tests/openedx_tagging/utils.py diff --git a/tox.ini b/tox.ini index 8c5fe2fcb..604bc3307 100644 --- a/tox.ini +++ b/tox.ini @@ -31,10 +31,11 @@ match-dir = (?!migrations) [pytest] DJANGO_SETTINGS_MODULE = test_settings -addopts = --cov openedx_learning --cov openedx_tagging --cov tests --cov-report term-missing --cov-report xml +addopts = --cov src --cov tests --cov-report term-missing --cov-report xml norecursedirs = .* docs requirements site-packages [testenv] +usedevelop = True # installs -e . deps = setuptools django42: Django>=4.2,<5.0 @@ -48,6 +49,7 @@ commands = pytest {posargs} [testenv:docs] +usedevelop = True # installs -e . setenv = DJANGO_SETTINGS_MODULE = test_settings PYTHONPATH = {toxinidir} @@ -60,13 +62,14 @@ deps = -r{toxinidir}/requirements/doc.txt commands = doc8 --ignore-path docs/_build README.rst docs - rm -f docs/openedx_learning.rst + rm -f docs/openedx_content.rst rm -f docs/modules.rst make -e -C docs clean make -e -C docs html python setup.py check --restructuredtext --strict [testenv:quality] +usedevelop = True # install -e . allowlist_externals = make rm @@ -75,11 +78,11 @@ deps = setuptools -r{toxinidir}/requirements/quality.txt commands = - pylint openedx_learning openedx_tagging tests test_utils manage.py setup.py + pylint src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py mypy --show-traceback - pycodestyle openedx_learning openedx_tagging tests manage.py setup.py - pydocstyle openedx_learning openedx_tagging tests manage.py setup.py - isort --check-only --diff tests test_utils openedx_learning openedx_tagging manage.py setup.py test_settings.py + pycodestyle src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py + pydocstyle src # don't need to lint docs for tests & utils + isort --check-only --diff src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py make selfcheck [testenv:pii_check]