Custom course tab with tutor plugin

I am trying to create a python package to add custom course tab. I have created scaffold using tutor cookiecutter. Have followed some code hacks from discussion openedx app. In setup.py I have following entry points:

entry_points={
        "tutor.plugin.v1": [
            "demo = demo.plugin"
        ],
        "openedx.course_tab": [
            "demo_schedules = demo_schedules.plugins:DemoSchedules",
        ]
    }

After installing plugin with pip install, the plugin does shows up in tutor plugins list and I have also enabled it. But the course tab does not appear on Course page.

I have seen some third party plugins and they all require adding it in $(tutor config printroot)/env/build/openedx/requirements/private.txt. I don’t know how to do that with tutor plugin I created because my plugin is not on git repo and using pip install locally on my local server.

Any idea how to make it work?

A course tab operates similarly to an xblock, in terms of installing and enabling it. You use the requirements folder to build it into the image, and then you have to put the project name in the course’s Advanced Module List to display it in a course. The course tab should then display in the studio Content > Pages list.

Regardless of enabling the tab in the course, you can also access the tab directly using the URL specified in the urls.py file because openedx.course_tab registers the tab globally (I think).

I recently built a chat tab for our platform, and I admit that figuring out the process wasn’t exactly easy. Reading my code might help you figure out what you missed: GitHub - tony-h/rocketchat-tab: Rocket.Chat integration into Open edX by adding a new Chat tab.. Perhaps you can install it as a Tutor plugin, but I installed it using an lms.djangoapp.

1 Like
  1. First, you place your code in $(tutor config printroot)/env/build/openedx/requirements/your-project.

  2. Then, you put the relative directory reference in private.txt, such as:
    -e ./your-project/

  3. Lastly, you need to rebuild the images

You can find additional details at Configuration and customisation — Tutor documentation

1 Like

Thanks for your kind input. I am using local dev with tutor. Does it requires rebuilding the image in dev mode also?

Hi @zishanj ,

This is correct. You have to build the images in dev mode to install the XBlocks or Django app. Then, you can start to work on your project. The system will recompile the code when it detects a change.

Because building the images takes so much time, I just start the full dev stack (CMS, LMS, and learning) and just leave it running in the background on my dev box.
tutor dev start -d > ~/tutor-build-log.txt 2>&1

You can watch the output or dump print messages there, such as:
tutor dev logs cms lms --tail 50 -f

Kind regards

Does in production also it auto-detects a change on github repo or there is a different process to update the code?

Can you elaborate this please? Is there special installation procedure to start with full dev stack with tutor?

You should first download the code and place in the requirements folder, like this:

# Change to the requirements directory
cd $(tutor config printroot)/env/build/openedx/requirements

# Clone a project
git clone https://github.com/some-user/some-project.git

# Add the project reference to include the Open edX images
echo "-e ./some-project/" >> private.txt

The code that you update in the development platform does not automatically sync back to GitHub. You can push code back to your GitHub project when you are ready to make a commit either from the requirements folder (using the command like) or copy the code back to your desktop environment and use the GUI.

I recommend reading the Tutor help docs on Open edX Development, specifically the section called “XBlock and edx-platform plugin development”.

You can start the full dev stack in detached/daemon mode using the command shown below. Tutor will run in the background until you stop it. Stopping it generally triggers the image rebuild process, which is why I rarely stop it during active development.

tutor dev start -d

Once running, the file watcher will trigger a recompile of the .py files upon change. You can then refresh the page in your browser to view the change. You can view the container logs (and follow them) using:

tutor dev logs cms lms --tail 50 -f

I hope this helps!