-
Notifications
You must be signed in to change notification settings - Fork 18
feat!: Make openedx_content and openedx_tagging flat, top-level APIs
#478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ad8d3bc to
03bd6d1
Compare
|
Maybe |
|
How does this compare to the similar version (like uv workspaces) where each app has its own dir and perhaps even its own That seems cleaner to me, but perhaps it's not achievable without using |
|
@bradenmacdonald ooh, uv workspaes seems like exactly the pattern we want going forward.
I think this new directory structure is compatible with an eventual switch to uv workspaces. I don't want to bite off switching to uv as part of this PR since so much of the Modular delivery work is waiting on it, but I'm supportive of ticketing it up as a future task. |
|
openedx-platform PR (WIP): openedx/openedx-platform#38004 |
|
In Slack, Dave and I discussed what to do about
|
|
I just realized that you haven't gotten around to removing media_server yet, which is fine. I'm just trying to take a first pass through even though it's in draft, to make sure I understand everything and can give a quicker turnaround when it is ready-for-review. |
src/openedx_content/settings_api.py
Outdated
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Folks will always need to install the backcompat apps, regardless of when they started using it. The first migration in openedx_content does state creation without database operations. Folks who start with a fresh install of openedx-platform release that points to 0.31.0 or later of this repo can skip the weird intermediate state where their platform models have foreign keys to the old apps, and just skip to directly making foreign keys to the openedx_content models from the beginning. But those old authoring models/tables are always created by the old models and transferred to openedx_content, regardless of which version you're starting at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, maybe not always. We can probably make a future squashed migration in openedx_content that skips the state transfer magic and just makes tables the normal way, and make more squashed migrations on the openedx-platform side to bridge into it. But as it stands right now, if you have a plugin, you'd need to include the backcompat apps in process when testing so those migrations would run, or openedx_content is going to complain that its dependency migrations aren't found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that transition would probably have to wait at least one release cycle, since putting that in Verawood would mess up people upgrading from Ulmo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense -- I just linked to your ADR, which describes this all better than I can
ormsbee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did my first pass. Minor request around comment wording for openedx_content_backcompat_apps_to_install, and media_server removal comments. The tagging stuff looks fine to me, but I don't know if there are any weird search-related issues around moving the app around—it seems unlikely, but I mention it in case it rings any bells for @bradenmacdonald.
5bd3bf0 to
015bcd1
Compare
kdmccormick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bradenmacdonald -- this is ready for review.
I haven't manually tested yet, but I'll do that in tandem with finishing the openedx-platform PR, which I just got a green build on.
Some miscellaneous notes ⬇️
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.11' | ||
| python-version: '3.12' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not critical to this PR, but this brings import-linter's python version up to date with unit tests.
|
|
||
| - name: Install Dependencies | ||
| run: pip install -r requirements/ci.txt | ||
| run: pip install -e . -r requirements/quality.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor requirements rejigger:
ci.in/ci.txtnow just installs tox, not import-linter. No need to install tox to run import-linter.- by adding
quality.txt, we gain the ability to lint imports into openedx-learning's dependencies, if we ever want to do that.quality.txtalso installs import-linter for us already. - with the new package structure, we need to add
-e ., otherwise import-linter doesn't see our root source packages.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where olx_importer belongs with this new packages structure, but I've opted not to worry about it for this PR.
| "openedx_tagging", | ||
| "openedx_content", | ||
| *openedx_content_backcompat_apps_to_install(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having a single openedx_core_apps_to_install function, I've opted to allow clients to choose which of our top-level apps (openedx_tagging, openedx_content, etc.) they'd like to install, letting them list those explicitly, and then just having the a helper function for the content backcompat apps.
My reasoning here is basically "explicit is better than implicit". If a dev is wondering how openedx_content is installed, they're gonna grep for "openedx_content", not for "openedx_core".
| ./manage.py makemessages -l en -v1 -d django | ||
| ./manage.py makemessages -l en -v1 -d djangojs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: I need to confirm that this works. Will do before merging, or will make a follow-up ticket if it isn't critical to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually broken because manage.py wasn't marked executable.
I pushed a commit to fix that, but also pushed a commit to generally enable translations on this repo, which they currently aren't. #483
src/openedx_content/settings_api.py
Outdated
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense -- I just linked to your ADR, which describes this all better than I can
Yeah, I don't think it should cause any problems. |
|
The code looks great, @kdmccormick. I'm going to rebuild my devstack and see if it works. |
|
Thanks @bradenmacdonald I smoke tested with the sandbox on openedx/openedx-platform#38004, and the only issue I hit is that when I try to back up the library, instead of downloading a ZIP, my browser gets redirected to |
|
Ah, it's an issue with all PR sandboxes right now, I Iet Kaustav know. |
Context
This PR aligns on the new project structure which @ormsbee , @bradenmacdonald and I discussed. It follows on the work which Dave did here:
openedx_contentapp #454This involves several breaking changes, which we've deemed OK since the package is still
v0.*. The accompanying openedx-platform PR which addresses all those breaking changes is here:After we merge those PRs, the final step will be to rename the repo and PyPI package to openedx-core.
openedx-core#471The new structure
New high-level applications will be added as peers of these packages. For example, we expect to have
src/openedx_catalogandsrc/openedx_learning.New capabilities which fit well into the existing application can be added as "applets" (ADR link). The goal is to have manageable number of well-separated django apps at the top level, internally organized into applets. The top-level apps are hard to refactor (due to migrations) but the internal applets are very easy to refactor.
importlinter is used to enforce boundaries between the djangoapps, as well as between their internal applets -- see
.importlinerconfig file.BREAKING CHANGES
Here are all the changes which a consumer of this package's public APIs would see:
openedx_tagging.core.tagging.*-->openedx_tagging.*openedx_learning.api.authoring-->openedx_content.apiopenedx_learning.api.authoring_models-->openedx_content.models_apiopenedx_learning.api.django.openedx_learning_apps_to_install-->openedx_content.settings_api.openedx_content_backcompat_apps_to_install"openedx_content"toINSTALLED_APPSin addition to splatting the results of this function in.openedx_learning.lib.*->openedx_django_lib.*openedx_learning.lib.cache--> removed. LRU caching didn't play well with rollbacks.openedx_learning.lib.test_utils--> removed. It was just there to help us clear the LRU cache during tests.openedx_learning.contrib.media_server--> removed