Tutor: Indigo Theme with New Plugin

Hello,

I am trying to upgrade our theme based off of indigo but trying to wrap my head around how to best to do it. The documentation for indigio talks about

This plugin can serve as a starting point to create your own themes. Just fork this repository and modify the files as you see fit.

which I feel is more for the original method, with the old helper render function that would copy files into the theme directory for building.

What I have done so far:

Just wanted to follow up what I have tried.

  1. I forked the repository (GitHub - newliteraciesalliance/tutor-nla-theme: NLA Theme for Tutor / OpenEdX) – See Comparing overhangio:master...newliteraciesalliance:master · overhangio/tutor-indigo · GitHub for the changes I made (kind of guessing here??)
  2. Cloned to to my server
  3. ran sudo pip install -e /path/to/cloned/repo (seemed to install correctly)
  4. It shows up in tutor plugins list, and I enabled it
  5. I ran tutor config save
  6. If I look at ls “$(tutor config printroot)/env/build/openedx/themes”, it only shows the pre-maple theme there and not the new one that I believe should have been installed (with tutor config save to indigo-nla per tutor-nla-theme/plugin.py at master · newliteraciesalliance/tutor-nla-theme · GitHub)

Thanks for any help!

Are you sure when you installed the plugin with sudo pip install -e /path/to/cloned/repo it installed to same pyenv which tutor is using?
I personally when I change plugin to a fork, I first remove the orignal one so I make sure the newly installed is the one taking effect

@ghassan I believe so?

This is what shows up with tutor plugins list where nla-indigo 14.0.2 is the indigio based them I installed.

acme                  	          	1.0.0
android               	(disabled)	14.0.0
change-user-password  	(disabled)	1.0.0
discovery             	(disabled)	14.0.0
ecommerce             	(disabled)	14.0.0
forum                 	(disabled)	14.0.0
googleanalytics       	          	0.1.0
license               	(disabled)	14.0.0
mfe                   	          	14.0.0
minio                 	(disabled)	14.0.0
nla-indigo            	          	14.0.2
nla_changes           	          	1.1.0
notes                 	(disabled)	14.0.0
richie                	(disabled)	14.0.0
saml                  	          	0.1.0
webui                 	(disabled)	14.0.0
xqueue                	(disabled)	14.0.0

Here is the output of when installing with pip

sudo pip install -e /klib/data/tutor-nla-theme/
Obtaining file:///klib/data/tutor-nla-theme
Requirement already satisfied: tutor<15.0.0,>=14.0.0 in /usr/local/lib/python3.8/dist-packages (from tutor-nla-theme==14.0.2) (14.0.2)
Requirement already satisfied: mypy in /usr/local/lib/python3.8/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (0.812)
Requirement already satisfied: pycryptodome in /usr/local/lib/python3.8/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (3.10.1)
Requirement already satisfied: jinja2 in /usr/lib/python3/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (2.10.1)
Requirement already satisfied: appdirs in /usr/local/lib/python3.8/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.4.4)
Requirement already satisfied: click>=7.0 in /usr/lib/python3/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (7.0)
Requirement already satisfied: pyyaml>=4.2b1 in /usr/lib/python3/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (5.3.1)
Requirement already satisfied: kubernetes in /usr/local/lib/python3.8/dist-packages (from tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (17.17.0)
Requirement already satisfied: typed-ast<1.5.0,>=1.4.0 in /usr/local/lib/python3.8/dist-packages (from mypy->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.4.3)
Requirement already satisfied: typing-extensions>=3.7.4 in /usr/local/lib/python3.8/dist-packages (from mypy->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (3.10.0.0)
Requirement already satisfied: mypy-extensions<0.5.0,>=0.4.3 in /usr/local/lib/python3.8/dist-packages (from mypy->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (0.4.3)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.14.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (2.22.0)
Requirement already satisfied: python-dateutil>=2.5.3 in /usr/local/lib/python3.8/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (2.8.1)
Requirement already satisfied: requests-oauthlib in /usr/local/lib/python3.8/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.3.0)
Requirement already satisfied: setuptools>=21.0.0 in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (45.2.0)
Requirement already satisfied: urllib3>=1.24.2 in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.25.8)
Requirement already satisfied: certifi>=14.05.14 in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (2019.11.28)
Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /usr/lib/python3/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (0.53.0)
Requirement already satisfied: google-auth>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (1.30.1)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/lib/python3/dist-packages (from requests-oauthlib->kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (3.1.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth>=1.0.1->kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (0.2.1)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from google-auth>=1.0.1->kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (4.2.2)
Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in /usr/local/lib/python3.8/dist-packages (from google-auth>=1.0.1->kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (4.7.2)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.6"->google-auth>=1.0.1->kubernetes->tutor<15.0.0,>=14.0.0->tutor-nla-theme==14.0.2) (0.4.2)
Installing collected packages: tutor-nla-theme
  Attempting uninstall: tutor-nla-theme
    Found existing installation: tutor-nla-theme 14.0.2
    Can't uninstall 'tutor-nla-theme'. No files were found to uninstall.
  Running setup.py develop for tutor-nla-theme
Successfully installed tutor-nla-theme

Also here is the output of pip list|grep tutor

tutor                  14.0.2
tutor-android          14.0.0
tutor-discovery        14.0.0
tutor-ecommerce        14.0.0
tutor-forum            14.0.0
tutor-license          14.0.0
tutor-mfe              14.0.0
tutor-minio            14.0.0
tutor-nla-theme        14.0.3               /klib/data/tutor-nla-theme
tutor-notes            14.0.0
tutor-richie           14.0.0
tutor-webui            14.0.0
tutor-xqueue           14.0.0

@ghassan any other ideas for what I might check?

Thanks!

Before doing running this:

Are you sure the plugin that resides in /klib/data/tutor-nla-theme/ is checked out to the correct branch? I am asking about this, because it might be the case that you made the changes to a spesfic branch which is not the default one….

But anyway I can concldue that when you changed the plugin name from indigo to nla-indigo. Thus this means some of your changes should be picked up. otherwise the plugin name would be indigo. But have you maked all your changes in one commit?, may be commit realted to theme are not picked up?

Yes, that is where I did git clone git@github.com:newliteraciesalliance/tutor-nla-theme.git, and no i’m just committing to the main branch, and after I made any changes I made sure to run sudo pip install -e /klib/data/tutor-nla-theme/. I assumed I needed to do that for python to pick up any possible changes, along with tutor config save (but this doesn’t appear to impact my indigo forked plugin).

ls /klib/data/tutor-nla-theme/
LICENSE.txt  MANIFEST.in  README.rst  screenshots  setup.py  tutor_nla_theme.egg-info  tutorindigo

The changes after running tutor config save should be reflected in "$(tutor config printroot)"/env/build/openedx/themes
Tutor will not change the plugin itself, it would rather use its template and then output the render in the above path

That’s what isn’t happening

[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $ echo $TUTOR_ROOT
/klib/data/nla-openedx
[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $ echo $TUTOR_PLUGINS_ROOT
/klib/data/nla-openedx/plugins
[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $ tutor plugins list
acme                  	          	1.0.0
android               	(disabled)	14.0.0
change-user-password  	(disabled)	1.0.0
discovery             	(disabled)	14.0.0
ecommerce             	(disabled)	14.0.0
forum                 	(disabled)	14.0.0
googleanalytics       	          	0.1.0
license               	(disabled)	14.0.0
mfe                   	          	14.0.0
minio                 	(disabled)	14.0.0
nla-indigo            	          	14.0.3
nla_changes           	          	1.1.0
notes                 	(disabled)	14.0.0
richie                	(disabled)	14.0.0
saml                  	          	0.1.0
webui                 	(disabled)	14.0.0
xqueue                	(disabled)	14.0.0
[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $ tutor config save
Configuration saved to /klib/data/nla-openedx/config.yml
Environment generated in /klib/data/nla-openedx/env
[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $ ls "$(tutor config printroot)"/env/build/openedx/themes
README  nla-theme
[TEST] tmisilo@test-nla20:/klib/data/tutor-nla-theme$ [git master] $

The nla-theme directory listed above is the original theme pre-plugin. The theme doesn’t seem to be created per tutor-nla-theme/plugin.py at master · newliteraciesalliance/tutor-nla-theme · GitHub

Okay I think I found inconsistency with your changes, I think you should rename the folder from

tutor-nla-theme/tutorindigo/templates/indigo/ to tutor-nla-theme/tutorindigo/templates/indigo-nla/
Bceause you change the filters to indigo-nla the folder/directory must be rennamed accordingly

Thank you @ghassan! That seemed to do it.

I will type of what changes I made for the future if people need to do this on their own.

2 Likes
--- a/tutorindigo/plugin.py
+++ b/tutorindigo/plugin.py
@@ -38,12 +38,12 @@
 # This is where the theme is rendered in the openedx build directory
 hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
     [
-        ("indigo", "build/openedx/themes"),
+        ("indigo-nla", "build/openedx/themes"),
     ],
 )
 
 # Force the rendering of scss files, even though they are included in a "partials" directory
-hooks.Filters.ENV_PATTERNS_INCLUDE.add_item(r"indigo/lms/static/sass/partials/lms/theme/")
+hooks.Filters.ENV_PATTERNS_INCLUDE.add_item(r"indigo-nla/lms/static/sass/partials/lms/theme/")
 
 # Load all configuration entries
 hooks.Filters.CONFIG_DEFAULTS.add_items(

Rename tutorindigo/templates/indigo/ to tutorindigo/templates/indigo-nla

--- a/setup.py
+++ b/setup.py
-    entry_points={"tutor.plugin.v1": ["indigo = tutorindigo.plugin"]},
+    entry_points={"tutor.plugin.v1": ["nla-indigo = tutorindigo.plugin"]},