WIP Proposal: Unified authoring app
#454
Draft
+1,069
−1,503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a wacky proposal that I've been kicking around in my head since I started working seriously on #452, and ran into issues with renaming the app and/or moving models around.
What is this?
This PR refactors the repo to combine all authoring apps (publishing, components, content, collections, etc.) into a single
authoringapp from Django's point of view. But the boundaries previously set up by the apps still exist inopenedx_learning.apps.authoring.applets.*which has different packages forcomponents,collections, and all the rest.Each of these sub-apps still have their own
models.pyandadmin.pyfiles, though these are all stitched together by the higher levelauthoringfiles. So for instance,openedx.apps.authoring.modelsimports everything from the sub-apps.We could make utility wrappers to make this more convenient later.(Edit: Introspection magic breaks code autocomplete.)It would look like:
Why do this?
I still believe that having small, discrete app-like things is useful for controlling complexity, and I don't want to give that up. That being said, refactoring is made much harder when we want to try to either change the names of real Django apps (e.g.
contentstomedia) or if we want to move models around (e.g.Container/ContainerVersionleaving thepublishingapp to go to a newcontainersapp). Having all the models be in one namespace will make shifting the boundaries between them much easier.This will have a few other minor benefits. We can do a top level
api.pyfile forauthoringin a way that's consistent with other apps in the system. It sort of sets up the umbrellaauthoringapp as the holder of the public interface. It also makes it less cumbersome to enter in the list of apps.On the downside, there's less consistency in terms of what goes where. Management commands, migrations, and app initialization code has to go in the root
authoringapp.How is it working?
The other apps disappear entirely, and are replaced by one
authoringapp. Theauthoringapp's initial migration tries to be smart–it will create a whole new set of tables if it's a new database, but if it detects an up-to-date Teak install of app migrations, it will take over the model state for all those models without running any database operations. (The second migration then changes all the table names to start withoel_authoring.) Being just post-release is a perfect time to do this pretty radical realignment.What to call it?
I'm not sure what to call this practice. I'm currently going with
authoringbeing an "umbrella app", and the small things being "applets"... but I'm open to suggestions.