Skip to content

Commit 015bcd1

Browse files
committed
feat!: Make openedx_content and openedx_tagging flat, top-level APIs
1 parent e42d2d9 commit 015bcd1

287 files changed

Lines changed: 444 additions & 704 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
branch = True
33
data_file = .coverage
44
source =
5-
openedx_learning
6-
openedx_tagging
5+
src
76
omit =
87
test_settings
98
**/migrations/*

.github/workflows/lint-imports.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
- name: setup python
1818
uses: actions/setup-python@v6
1919
with:
20-
python-version: '3.11'
20+
python-version: '3.12'
2121

2222
- name: Install pip
2323
run: pip install -r requirements/pip.txt
2424

2525
- name: Install Dependencies
26-
run: pip install -r requirements/ci.txt
26+
run: pip install -e . -r requirements/quality.txt
2727

2828
- name: Analyze imports
2929
run: lint-imports

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ output/*/index.html
5454
# Sphinx
5555
docs/_build
5656
docs/modules.rst
57-
docs/openedx_learning.rst
58-
docs/openedx_learning.*.rst
57+
docs/openedx_content.rst
58+
docs/openedx_content.*.rst
5959

6060
# Private requirements
6161
requirements/private.in
@@ -66,6 +66,7 @@ dev.db*
6666

6767
# virtualenv
6868
venv/
69+
.venv/
6970

7071
### Visual Studio Code ###
7172
# Generally ignore VS Code configuration, except...

.importlinter

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,64 @@
1-
# openedx_learning is intended to be a library of apps used across multiple
1+
# This repo is intended to be a library of apps used across multiple
22
# projects, and we want to ensure certain dependency relationships. Please
33
# think through any changes you make to this file carefully, and don't just
44
# casually modify these linting rules to "fix the build".
5+
56
[importlinter]
6-
root_package = openedx_learning
7-
8-
# This is the most basic layering for openedx_learning.
9-
#
10-
# The "lib" package is meant for low level utilities, field definitions, and the
11-
# like, so it's at the bottom layer.
12-
#
13-
# The "core" apps are meant to be the heart of our system, with foundational
14-
# data models and plugin interfaces. It can rely on "lib" utilities.
15-
#
16-
# The "contrib" apps are meant to be apps that could easily be created outside
17-
# of openedx_learning in a separate repository, but are bundled here because
18-
# we think they'll be generally useful. These apps may call into "core" or "lib"
19-
# apps, but not the other way around. The "core" apps should *never* import from
20-
# "contrib".
21-
[importlinter:contract:openedx_learning_layering]
22-
name = Lib / Core / Contrib Layering
7+
root_packages =
8+
openedx_content
9+
openedx_tagging
10+
openedx_django_lib
11+
openedx_core
12+
13+
# This is layering within our top-level src folders (mostly Django apps).
14+
# This should be updated as new Django apps are added.
15+
# It's possible this might need to grow into multiple rules.
16+
[importlinter:contract:src_layering]
17+
name = "top-level source folders are layered correctly"
2318
type = layers
24-
layers=
25-
openedx_learning.contrib
26-
openedx_learning.apps
27-
openedx_learning.lib
19+
layers =
20+
# Content is currently the highest-level thing in this repo.
21+
# Over time, we may add apps "above" or "below" this.
22+
openedx_content
23+
24+
# Tagging is very simple & fundamental. Should probably not depend on any other Django apps.
25+
openedx_tagging
26+
27+
# Django utilities. Should not dependend on any of the real apps (above).
28+
openedx_django_lib
29+
30+
# This just a empty packages to expose the __version__ number.
31+
# Should not depend on anything.
32+
openedx_core
2833

29-
# This is layering within our Authoring apps. Every new app should be added to
34+
# This is layering within our Content applets. Every new applet should be added to
3035
# this list when it it created.
31-
[importlinter:contract:core_apps_layering]
32-
name = Authoring App Dependency Layering
36+
[importlinter:contract:content_applet_layering]
37+
name = "openedx_content's internal applets are layered correctly"
3338
type = layers
3439
layers=
35-
# The public authoring API is at the top–none of the apps should call to it.
36-
openedx_learning.api.authoring
40+
# The public API is at the top. None of the apps should call to it.
41+
openedx_content.api
3742

3843
# The "backup_restore" app handle the new export and import mechanism.
39-
openedx_learning.apps.openedx_content.applets.backup_restore
44+
openedx_content.applets.backup_restore
4045

4146
# The "components" app is responsible for storing versioned Components,
4247
# which is Open edX Studio terminology maps to things like individual
4348
# Problems, Videos, and blocks of HTML text. This is also the type we would
4449
# associate with a single "leaf" XBlock–one that is not a container type and
4550
# has no child elements.
46-
openedx_learning.apps.openedx_content.applets.components
51+
openedx_content.applets.components
4752

4853
# The "contents" app stores the simplest pieces of binary and text data,
4954
# without versioning information. These belong to a single Learning Package.
50-
openedx_learning.apps.openedx_content.applets.contents
55+
openedx_content.applets.contents
5156

5257
# The "collections" app stores arbitrary groupings of PublishableEntities.
5358
# Its only dependency should be the publishing app.
54-
openedx_learning.apps.openedx_content.applets.collections
59+
openedx_content.applets.collections
5560

5661
# The lowest layer is "publishing", which holds the basic primitives needed
5762
# to create Learning Packages and manage the draft and publish states for
5863
# various types of content.
59-
openedx_learning.apps.openedx_content.applets.publishing
64+
openedx_content.applets.publishing

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ include CHANGELOG.rst
22
include LICENSE.txt
33
include README.rst
44
include requirements/base.in
5-
recursive-include openedx_learning *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py
6-
recursive-include openedx_tagging *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py *.yaml *.json *.csv
5+
recursive-include src *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.py *.yaml *.json *.csv

Makefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,14 @@ selfcheck: ## check that the Makefile is well-formed
8383

8484
extract_translations: ## extract strings to be translated, outputting .mo files
8585
rm -rf docs/_build
86-
cd openedx_learning && ../manage.py makemessages -l en -v1 -d django
87-
cd openedx_learning && ../manage.py makemessages -l en -v1 -d djangojs
88-
cd openedx_tagging && ../manage.py makemessages -l en -v1 -d django
89-
cd openedx_tagging && ../manage.py makemessages -l en -v1 -d djangojs
86+
./manage.py makemessages -l en -v1 -d django
87+
./manage.py makemessages -l en -v1 -d djangojs
9088

9189
compile_translations: ## compile translation files, outputting .po files for each supported language
92-
cd openedx_learning && ../manage.py compilemessages
93-
cd openedx_tagging && ../manage.py compilemessages
90+
./manage.py compilemessages
9491

9592
detect_changed_source_translations:
96-
cd openedx_learning && i18n_tool changed
97-
cd openedx_tagging && i18n_tool changed
93+
cd src && i18n_tool changed
9894

9995
pull_translations: ## pull translations from Transifex
10096
tx pull -a -f -t --mode reviewed
@@ -103,8 +99,7 @@ push_translations: ## push source translation files (.po) from Transifex
10399
tx push -s
104100

105101
dummy_translations: ## generate dummy translation (.po) files
106-
cd openedx_learning && i18n_tool dummy
107-
cd openedx_tagging && i18n_tool dummy
102+
cd src && i18n_tool dummy
108103

109104
build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files
110105

README.rst

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,22 @@ Open edX Learning Core (and Tagging)
77
Overview
88
--------
99

10-
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.
10+
The ``openedx-learning`` project holds Django apps that represent core learning platform concepts.
1111

1212
Motivation
1313
----------
1414

15-
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.
15+
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.
1616

17-
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.
17+
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.
1818

1919
Architecture
2020
------------
2121

22-
Parts
23-
~~~~~
24-
25-
* ``openedx_learning.lib`` is for shared utilities, and may include things like custom field types, plugin registration code, etc.
26-
* ``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.
27-
* ``openedx_tagging.core`` contains the core Tagging app, which provides data structures and apis for tagging Open edX objects.
28-
2922
Learning Core Package Dependencies
3023
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3124

32-
Learning Core code should never import from ``edx-platform``.
25+
Learning Core code should never import from ``openedx-platform``.
3326

3427
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 <docs/decisions/0016-python-public-api-conventions>`_ for more details.
3528

@@ -56,7 +49,7 @@ The structure of this repo follows [OEP-0049](https://open-edx-proposals.readthe
5649
Code Overview
5750
-------------
5851

59-
The ``openedx_learning.apps`` package contains all our Django applications.
52+
The ``src`` folder contains all our Django applications.
6053

6154
Development Workflow
6255
--------------------

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_version(*file_paths):
3535
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
3636
sys.path.append(REPO_ROOT)
3737

38-
VERSION = get_version('../openedx_learning', '__init__.py')
38+
VERSION = get_version('src/openedx_core', '__init__.py')
3939

4040
# Configure Django for autodoc usage
4141
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'

mypy.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ plugins =
66
mypy_django_plugin.main,
77
mypy_drf_plugin.main
88
files =
9-
openedx_learning,
10-
openedx_tagging,
9+
src,
1110
tests
1211

1312
[mypy.plugins.django-stubs]

mysql_test_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
-p 3306:3306 mysql:8
1818
"""
1919

20-
from test_settings import *
20+
from test_settings import * # pylint: disable=wildcard-import
2121

2222
DATABASES = {
2323
"default": {

0 commit comments

Comments
 (0)