Skip to content
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

feat!: remove dependency on Paver scripts #1042

Merged

Conversation

kdmccormick
Copy link
Collaborator

@kdmccormick kdmccormick commented Apr 18, 2024

Description

feat!: remove dependency on Paver scripts

BREAKING CHANGE: openedx-assets is replaced with npm run subcommands. For details, see the changelog entry.
For further details and rationale, see the upstream DEPR ticket: openedx/edx-platform#34467

Testing

I have been testing this locally with both the default theme and Indigo, both local and dev.

Since openedx/edx-platform#34318 merged, these npm build commands are being used for production edx.org builds, and no issues have been identified so far.

Future work

This is one of the few remaining steps before we can delete Paver from edx-platform. It will also unlock the ability to build assets without installing edx-platform's base Python requirements, which could seriously speed up the image build.

Merge deadline

In order to do the "future work" before Sumac, I'd like to merge this PR before Redwood (Jun 9). Ideally, we merge this before the testing period begins (May ~9) so that BTR has a chance to catch any issues.

@kdmccormick kdmccormick requested a review from regisb April 18, 2024 04:24
@kdmccormick
Copy link
Collaborator Author

@regisb here it is!

@kdmccormick kdmccormick marked this pull request as draft April 18, 2024 04:29
@kdmccormick
Copy link
Collaborator Author

image

I did some more local testing and now I'm hitting this error 🤦🏻 Sorry, I guess this PR isn't quite ready to go yet.

@regisb , would you be willing to give it a preliminary review, so that Dawoud and I could feel feel comfortable merging it while you're away?

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking forward to this change!

@@ -1,218 +0,0 @@
#! /usr/bin/env python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouiiiiiiiiiiiiiiiiiii!!!

Here is a migration guide, where each command is to be run in the `lms` or `cms` container.
| **Before** | **After** |
|------------------------------------------|-------------------------------------------------------------------------------------|
| `openedx-assets build --env=prod ARGS` | `npm run build -- ARGS` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very clear for people who are familiar with Tutor's openedx-assets comand. Is there a reference document that explains all these new npm commands? Unfortunately we can't add comments to package.json because it's JSON.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't yet, but I'll add a reference doc to edx-platform and link it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines -30 to -31
COMPREHENSIVE_THEME_DIRS: ["/openedx/themes"]
STATIC_ROOT_BASE: "/openedx/staticfiles"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: Since this edx-platform change, we can specify these as environment variables (in the Dockerfile) and they will be automatically loaded into Django settings.

@kdmccormick kdmccormick marked this pull request as ready for review May 7, 2024 18:58
@kdmccormick
Copy link
Collaborator Author

@DawoudSheraz , could you review this?

Copy link
Contributor

@DawoudSheraz DawoudSheraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image is building fine. I will do some testing on local and provide a review.

@hinakhadim
Copy link
Contributor

The image has been built successfully. But the indigo theme hasn't been applied to openedx(LMS, CMS) and it has been applied to MEFs perfectly. Getting this error in LMS container while I've checked the indigo theme is mounted correctly to LMS container. I am debugging this why I've got this error.

[openedx.core.djangoapps.theming.helpers] [user None] [ip 192.168.65.1] helpers.py:209 - Theme not found in any of the themes dirs. [Theme 'indigo' not found in any of the following themes dirs, 
2024-05-09 19:54:28 Theme dirs: 
2024-05-09 19:54:28 []]
2024-05-09 19:54:28 Traceback (most recent call last):
2024-05-09 19:54:28   File "/openedx/edx-platform/./openedx/core/djangoapps/theming/helpers.py", line 204, in get_current_theme
2024-05-09 19:54:28     themes_base_dir=get_theme_base_dir(site_theme.theme_dir_name),
2024-05-09 19:54:28   File "/openedx/edx-platform/./openedx/core/djangoapps/theming/helpers.py", line 242, in get_theme_base_dir
2024-05-09 19:54:28     raise ValueError(
2024-05-09 19:54:28 ValueError: Theme 'indigo' not found in any of the following themes dirs, 
2024-05-09 19:54:28 Theme dirs: 
2024-05-09 19:54:28 []

@@ -5,9 +5,6 @@
from openedx.core.lib.derived import derive_settings

ENABLE_COMPREHENSIVE_THEMING = True
COMPREHENSIVE_THEME_DIRS.append('/openedx/themes')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my system, ENABLE_COMPREHENSIVE_THEMING is already enabled and have confirmed this using shell of lms container. and in ENV variables, COMPREHENSIVE_THEME_DIRS is added. the problem is LMS doesn't pick COMPREHENSIVE_THEME_DIRS from Env variables. It picks its value using themes_dirs = get_theme_base_dirs_from_settings(settings.COMPREHENSIVE_THEME_DIRS).

There are two options here:

  1. move COMPREHENSIVE_THEME_DIRS back to settings variable
  2. Make changes in edx-platform to pick COMPREHENSIVE_THEME_DIRS value using get_env_setting

Any of these solution is not being done in https://github.com/openedx/edx-platform/pull/34318/files.

image

If there seems other alternative solution, feel free to propose here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for testing @hinakhadim . Are you sure you are on the latest master for edx-platform? It's possible I missed something, but my intention was to load settings.COMPREHENSIVE_THEME_DIRS from the environment variable of the same name: https://github.com/openedx/edx-platform/blob/0d4adaa5d70364fe9ff0857b15cbc58cf952f584/cms/envs/common.py#L2205

COMPREHENSIVE_THEME_DIRS = os.environ.get("COMPREHENSIVE_THEME_DIRS", "").split(":")

This behavior was added in this commit openedx/edx-platform@21a1235 (original PR)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for information, @kdmccormick. I have tested with latest master for edx-platform and it is now loading the indigo theme and picking value of COMPREHENSIVE_THEME_DIRS from env. So, everything is fine from my side.

BREAKING CHANGE: `openedx-assets` is replaed with `npm run` subcommands.
For details, see the changelog entry.
For further details and rationale, see the upstream DEPR ticket:
openedx/edx-platform#31895
@kdmccormick
Copy link
Collaborator Author

@DawoudSheraz @hinakhadim did either of you want folks want more time to review before I merge this?

@DawoudSheraz
Copy link
Contributor

@DawoudSheraz @hinakhadim did either of you want folks want more time to review before I merge this?

I have not had a chance to test it out locally. Although, I trust Hina's testing and insights on this.

@hinakhadim
Copy link
Contributor

@kdmccormick Can you please elaborate this? https://github.com/openedx/edx-platform/blob/master/scripts/watch_sass.sh#L96 . I tried to run tutor dev and test watchthemes by making changes in tutor-indigo theme. watchthemes isn't detecting the changes. I guess the issue is of EDX_PLATFORM_THEME_DIRS variable

@kdmccormick
Copy link
Collaborator Author

@hinakhadim you're absolutely right, that is my mistake! Could you review the fix openedx/edx-platform#34805 ? I will also backport that to Redwood.

@hinakhadim
Copy link
Contributor

thanks @kdmccormick for the fix. I have tested with tutor local and tutor dev and everything is working fine. Go ahead for merging this PR after merging of openedx/edx-platform#34805 .

@kdmccormick
Copy link
Collaborator Author

Thanks @hinakhadim !

@kdmccormick kdmccormick merged commit c84a741 into overhangio:nightly May 16, 2024
2 checks passed
@kdmccormick kdmccormick deleted the kdmccormick/assets-build branch May 16, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants