Shorter
Some edx-platform code has moved around! Rebase your branches and reboot your development stacks. More details below.
Longer
Hey folks! A while back I posted about how Koa changed some edx-platform import paths in order to simplify the platform and remove some nasty tooling hacks. I’m posting again to share & celebrate some more simplifications that will be finished ahead of the Dec 2022 Olive release. All of these changes have already landed in master, except the capa
and xblock_discussion
changes which I expect will land soon.
(For those interested in the context and reasoning behind the changes, check out BOM-2579.)
Implications
General notes
-
The edx-platform folder
./common/lib
will be deleted. Its contents have been moved to various other locations. Some import paths have been changed in order to make this happen. You can see the Detailed Changes in the next section below. -
There is a new top-level code directory in edx-platform:
./xmodule
. -
Once the last couple changes land… going forward, if you see
import <BLAH>
in edx-platform, you can assume that either (a) it’s importing from an external library, or (b)<BLAH>
represents the full path to the module, relative to the root of edx-platform. This is a pretty basic assumption that most Python projects have, so I’m happy that it’s finally true for the platform
Special notes for edx-platform developers who follow master
If you have an open pull request against master, rebase your branch in order to avoid any potential logical merge conflicts and/or false-positives from the test suite.
For Devstack & Tutor Nightly users: When you pull these changes from master, you may run into strange errors about missing modules or unsatisfied requirements. If you see these, I recommend:
- Bringing down containers
- Pulling new images
- Git-pulling the latest edx-platform code
- Running
make clean
to delete all__pycache__
directories, which might be caching old compiled code - Running
git clean -fd common/lib/
to ensure any old code is properly deleted (NOTE: This will delete all untracked files incommon/lib
. If you have unsaved work there, back it up first!) - Starting containers back up
- Rebuilding static assets
- For Tutor users who mount a local virtualenv: using
make requirements
in an LMS shell to uninstall the local projects and re-install the correct requirements.
Special notes for edx-platform operators
- If you have a fork of edx-platform that changes code in
common/lib
, then when you eventually rebase onto Olive, ensure that your changes are reflected in the new code locations. Make sure you don’t accidentally recreate thecommon/lib
directory; any code placed there would be ignored. - If you maintain code that imports modules from
edx-platform/common/lib
, you may need to update some of those import paths. - The Python dependencies lists in
edx-platform/requirements
no longer point to any code in the local repository. So, if you maintain a Dockerfile or other sort of edx-platform build script, you now have the option of copying in and installing requirement files before copying in the code directories.
Detailed Changes
symmath
- before Nutmeg:
- location:
edx-platform/common/lib/symmath/symmath
- usage:
import symmath
- location:
- in Nutmeg:
- location:
openedx-calc/symmath
- usage:
import symmath
- location:
- PR: Remove symmath from edx-platform by Carlos-Muniz · Pull Request #29869 · openedx/edx-platform · GitHub
safe_lxml
- before Olive:
- location:
edx-platform/common/lib/safe_lxml/safe_lxml
- usage:
import safe_lxml
- location:
- in Olive:
- location:
edx-platform/openedx/core/lib/safe_lxml
- usage:
import openedx.core.lib.safe_lxml
- location:
- PR: refactor: make safe_lxml an ordinary folder in openedx/core/lib by kdmccormick · Pull Request #25689 · openedx/edx-platform · GitHub
sandbox-packages (loncapa, verifiers, eia)
- before Olive:
- location:
edx-platform/common/lib/sandbox-packages/*
- usage:
import loncapa, verifiers, eia
- location:
- in Olive:
- location:
codejail-includes
- usage:
import loncapa, verifiers, eia
- location:
- PR: feat!: Removing sandbox folder from platform and installing it from p… by awais786 · Pull Request #30402 · openedx/edx-platform · GitHub
xmodule
- before Olive:
- location:
edx-platform/common/lib/xmodule/xmodule
- usage:
import xmodule
- location:
- in Olive:
- location:
edx-platform/xmodule
- usage:
import xmodule
- location:
- PR: https://github.com/openedx/edx-platform/pull/30394
capa
- before Olive:
- location:
edx-platform/common/lib/capa/capa
- usage:
import capa
- location:
- in Olive:
- location:
edx-platform/xmodule/capa
- usage:
import xmodule.capa
- location:
- PR (still in-progress as of this post): refactor: move common/lib/capa/capa to xmodule/capa by iamsobanjaved · Pull Request #30403 · openedx/edx-platform · GitHub
xblock_discussion
- before Olive:
- location:
edx-platform/openedx/core/lib/xblock_builtin/xblock_discussion
- usage:
import xblock_discussion
- location:
- in Olive:
- location:
edx-platform/xmodule/discussion_block.py
- usage:
import xmodule.discussion_block
- location:
- PR (still in-progress as of this post): Refactor discussions_xblock by aht007 · Pull Request #30636 · openedx/edx-platform · GitHub
Thanks!
Thank you, all those who have helped with this big refactoring:
- @Usama_Sadiq , @mumarkhan999 , @Jawayria, @aht007, @Awais_Qureshi ,@Soban_Javed and anyone else on the Arbi-BOM squad, who wrote and reviewed many of these PRs
- @jmbowman who allocated resources for this and ensured it was prioritized
-
@cmuniz who did the
symmath
extraction - @feanil who helped review
- @chaugh and anyone else on edX T&L who were dutifully on call while we merged these changes to master
Bit by bit, we’re simplifying edx-platform & making it more accessible for operators and developers who want to help shape the future of education