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

E0d/update first pr #858

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 126 additions & 58 deletions source/developers/quickstarts/first_openedx_pr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ Quick Start: First Open edX Pull Request
:local:
:class: no-bullets

Welcome to the Quickstart guide for new Open edX contributors. By the end of
this tutorial, you will have completed all the steps necessary to begin
contributing to the Open edX project.
Welcome to the Quickstart guide for new Open edX contributors.

This tutorial is focused on teaching you how to make a noticiable
change to the platform equivalent to a "hello world" exercise.

By the end of this tutorial, you will have completed all the steps
necessary to begin contributing to the Open edX project.

These include:

Expand All @@ -17,7 +21,7 @@ These include:
* `Signing your Contributor License Agreement (CLA).`_

We assume you are comfortable with the command line, and understand the basics
of using Git, GitHub, and python basics.
of using Git, GitHub, Docker, and python basics.

.. This Quickstart is written for first-time contributors to the Open edX project.
If you are a plug-in developer or a frontend developer, please see our
Expand Down Expand Up @@ -48,7 +52,7 @@ the basics of using them, before proceeding:

* Additionally, we strongly recommend setting up 2-factor authentication.

* `Python 3.8 <https://www.python.org/downloads/>`_
* `Python 3.11 <https://www.python.org/downloads/>`_

* Your favorite code editor (our team uses
`VSCode <https://code.visualstudio.com/download>`_,
Expand Down Expand Up @@ -79,44 +83,21 @@ from the `official Docker documentation
to the Docker daemon.


Installing Tutor Nightly
Installing Tutor Main
************************

Navigate into a folder to hold your Open edX repositories.
We will assume you're using ``~/openedx``, but you can choose any folder.

.. code-block:: bash
Tutor main is the best solution for using Tutor as your development
environment and tracking the bleeding edge of the Open edX platform
code.

mkdir -p ~/openedx
cd ~/openedx

Create a Python 3.8 virtual environment (we'll call it ``tutor-venv``) and activate it:

.. code-block:: bash
Follow the official instructions for installing Tutor Main.

python3.8 -m venv tutor-venv
. tutor-venv/bin/activate
.. admonition:: The Tutor documents will recommend this as well, but
Copy link
Contributor

@sarina sarina Mar 5, 2025

Choose a reason for hiding this comment

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

I don't know why this isn't working but I don't use this directive, I use .. note:: or .. warning::

But, maybe the following text is indented wrong? You could just soft-wrap the line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarina sorted it out. A combination of how the admonition title works and how the details are formatted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, noticing that admonition provides 0 styling, which isn't super useful. Does warning or another option provide styling?

please do yourself the favor or using python virtual
Copy link

Choose a reason for hiding this comment

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

Grammatical mistake - "of" rather than "or".... "please do yourself the favor of using python virtual..."

enviroments. Doing so will make managing multiple
repositories and dependency versions much easier.

Install Tutor. This is a tool that helps you run the Open edX project.
We will install the "Nightly" version of Tutor, which means it will run the latest
version of the code (as opposed to the most recent named release):

.. code-block:: bash

git clone --branch=nightly https://github.com/overhangio/tutor.git
pip install -e "./tutor[full]"

Finally, let's configure and provision your Open edX instance!
You will be asked a couple questions.
Answer them however you like, although the default answers will work fine.

.. code-block:: bash

tutor dev launch

Depending on your system and your Internet connection speed,
this could take anywhere from five minutes to over an hour,
so go get a coffee and come back for the next part.
`Official Tutor tutorial <https://docs.tutor.edly.io/tutorials/main.html#running-open-edx-on-the-master-branch-tutor-main>`_
Copy link

Choose a reason for hiding this comment

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

I'm still wrapping my head around the different types of Tutor - Main, Full, Nightly(?). I did find that this link was the most straight forward as far as just getting it installed as a python package (although it does mention other ways): https://docs.tutor.edly.io/install.html#install



Working with a fork
Expand Down Expand Up @@ -175,38 +156,122 @@ To have Tutor run your local fork of edx-platform, you have to tell it to do so
on start up. It is a simple CLI parameter that points Tutor to the directory where
the code lives.

As a first step, fire up a one-off LMS container while mounting your local
checkout:
To set up your local enviroment to update edx-platform, follow the
`official instructions
<https://docs.tutor.edly.io/tutorials/edx-platform.html>`_
Copy link

Choose a reason for hiding this comment

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

I know this was referenced in the forums discussion, but after going through it, I found it not as helpful for the following reasons:

  • it has some grammatical errors "edx-plaform" instead of "edx-platform" on the workspace path.
  • the confusion of using the named release versus master depending on which Tutor you're using
  • "This command does a few "magical" things behind the scenes" - I believe it's missing the actual command which may be tutor dev launch because I'm confident tutor mounts add does not do what it's explaining.
  • it tells you to tutor images build openedx instead of building openedx-dev. I may be learning still, but I was never able to see my changes reflected on the screen when I built the non "-dev" image.

I would suggest that consolidating the link you mentioned and this one: https://docs.tutor.edly.io/dev.html#first-time-setup so it's more clear on what commands are to be run in order to get your instance running, and get your changes on the legacy platform reflected locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you say tutor mounts add does not do what it's explaining, are you referring to this section?

Similarly, when developing a custom XBlock, we would like to hot-reload any change we make to the XBlock source code within the containers.

Tutor provides a simple solution to these questions. In both cases, the solution takes the form of a tutor mounts add ... command.

Copy link

Choose a reason for hiding this comment

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

No, further down in the docs:
image

Although re-reading it I have misunderstood that this command is meant to be used in combination with the others since it bind mounts the edx-platform image for build-time or at run-time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Submitted a PR to fix the "edx-plaform" typo.

overhangio/tutor#1205

@tonybusa, if you still have specific suggestions on how to improve those docs, contributions would be very welcome! :)


From this point on, whatever changes you make to the code in your clone should
be visible in your local LMS instance immediately.

Working with an MFE
===================

Most of the Open edX platform's frontends have migrated from backend
Django templates to microfrontends based on the React framework
(MFEs). If you are interested in updating frontend code, MFEs are
probably where you want to focus. There are different ways of
configuring your development environment, but a common one is to use
Tutor to serve the backend services and run your MFE locally using npm
dev start.

To run MFEs in Tutor requires enabling a plugin, Tutor MFE.

Start by verifying that the mfe plugin is installed and enabled

.. code-block:: bash

tutor dev run --mount=./edx-platform lms bash
(tutor-main) $ tutor plugins list

NAME STATUS VERSION
discovery installed 19.0.0
forum installed 19.0.0
indigo ✅ enabled 19.0.1
jupyter installed 19.0.0
mfe ✅ enabled 19.0.0

Now within the container, install python requirements and rebuild static assets
for your local checkout:
If mfe isn't enabled run the following command to do so

.. code-block:: bash

pip install -e .
npm install
openedx-assets build --env=dev
exit
(tutor-main) $ tutor plugins enable mfe
(tutor-main) $ tutor dev stop
(tutor-main) $ tutor dev launch

After exiting the one-off container, restart the LMS with the local checkout
mounted:
Once Tutor has restarted with MFE enabled you will see a few more URLs listed.

.. code-block:: bash

tutor dev start --mount=./edx-platform lms
http://apps.local.openedx.io:1984/communications
http://apps.local.openedx.io:1990/learner-record
http://apps.local.openedx.io:1993/ora-grading
http://apps.local.openedx.io:1994/gradebook
http://apps.local.openedx.io:1995/profile
http://apps.local.openedx.io:1996/learner-dashboard
http://apps.local.openedx.io:1997/account
http://apps.local.openedx.io:2000/learning
http://apps.local.openedx.io:2002/discussions

From this point on, whatever changes you make to the code in your clone should
be visible in your local LMS instance immediately.
These ports and paths are to specific MFEs made available via the MFE plugin.

In order to develop locally, you will need to fork and clone the MFE
repoistory as you did for edx-platform, bind mount the directory, stop
the Tutor-hosted MFE and start a local npm dev server.

First, you should verify that the learner dashboard is working
correctly after you have installed the MFE plugin. Assuming
everything is configured in the standard way, your URL should be
``http://apps.local.openedx.io:1996/learner-dashboard/``

Follow the same, fork, clone workflow described above and clone the
learner-dashboard
``https://github.com/openedx/frontend-app-learner-dashboard``
repository locally.

Add a tutor mount for your cloned directory.

.. code-block:: bash

(tutor-main) $ tutor mounts add /home/git/frontend-app-learner-dashboard

Next, ensure that the learner-dashboard MFE is stopped

.. code-block:: bash

(tutor-main) $ tutor dev stop learner-dashboard

Reloading the profile should now yield an error.

Now its time to replace the default Tutor-hosted learner-dashboard with a
local version. That version will use a dev config file to connect to
the Tutor-hosted backend and to bind to the expected port.

.. admonition:: Not every MFE currently has a dev profile that will
work with Tutor, though it is possible to create one if that is the
case for the MFE you are developing.

From the directory containing the local copy of the learner-dashboard
repository start the npm dev server.

.. code-block:: bash

(tutor-main) $ npm run dev

Exercise: Update the Learner Dashboard
**************************************

The Learner Dashboard is the first page that students will see when they log
into Open edX. On our Tutor dev environment, it is located at
The Learner Dashboard is the first page that students will see after they log
into Open edX.

The dashboard page will either be provided by a legacy server side template or by the learner-dashboard MFE. Working with the MFE is usually the best choice. Note that this tutorial is simplistic and appropriate to get started. However, we don't recommend forking an MFE to customize it. For extensive modifications, that might be necessary, but for simple things using design tokens and frontend plugin slots will be a much better alternative.

Working with the Learner Dashboard MFE
======================================


Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arbrandes thoughts about a change that makes sense to kick the tires? I updated a string in messages.json which I didn't think we great, it would be better to change a little react code I think.


Working with the Legacy Learner Dashboard
=========================================
On our Tutor dev environment, it is located at
``http://local.overhang.io:8000/dashboard``

.. image:: /_images/developers_quickstart_first_pr/learner_dashboard_before.png
Expand All @@ -217,7 +282,7 @@ is not a change that will be merged upstream, but it will demonstrate the
steps you will have to go through to make a real change.

Edit the Template
=================
~~~~~~~~~~~~~~~~~

The template file for this page is at ``lms/templates/dashboard.html``. We're
going to add a simple welcome message to the ``dashboard-notifications`` div::
Expand All @@ -235,8 +300,11 @@ file. When you reload it in your browser, you should see something like this:
.. image:: /_images/developers_quickstart_first_pr/learner_dashboard_after.png
:alt: Learner Dashboard page after we add the welcome message.

Standard Operating Procedure For Backend or Frontend Changes
============================================================

Make a Commit
=============
-------------

Now that you've saved your changes, you can make a commit. First make a new
branch with the name ``developer_quickstart``::
Expand All @@ -251,7 +319,7 @@ be prefixed with "feat:" like so::
commit -a -m "feat: add welcome message to learner dashboard"

Push the Commit to Your Fork
============================
----------------------------

Now push your changes to a new branch in your fork::

Expand All @@ -265,7 +333,7 @@ Learn more about authentication `here <https://docs.github.com/en/authentication


Create A Pull Request
*********************
---------------------

Go to your fork.

Expand Down