cookiecutter-openedx / openedx-plugin-example

Python-Django scaffolding for common use cases
GNU Affero General Public License v3.0
12 stars 7 forks source link

Unable to install with Tutor 17.0.3 #22

Open graeme44 opened 2 months ago

graeme44 commented 2 months ago

I'm struggling to get this working with my setup of Tutor and Openedx, it's a fresh install of Tutor version 17.0.3 with edx-platform on open-release/quince.master.

Steps to reproduce:

Set up python env and tutor:

pyenv virtualenv 3.8.19 openedx
pyenv activate opened
pip install "tutor[full]==17.0.3"

Clone the Open EdX platform and switch to the Quince branch and bind-mount the dir:

git clone https://github.com/openedx/edx-platform && cd edx-platform
git checkout open-release/quince.master
tutor mounts add ./../edx-platform

Run the steps in the openedx-plugin-example to install in Tutor:

pip install openedx-plugin-example
tutor config save       # to ensure that tutor's root folder system has been created
echo "openedx-plugin-example" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"
tutor images build openedx
tutor local launch

Note: The requirements dir didn't exist, so I created it manually and ran it again (the private.txt was deprecated from version 17.0.0 in favour of using tutor mounts add ...)

Output / Errors:

The plugin was not loaded and is not part of the python environment:

tutor local exec lms bash
app@d2bfcb974b21:~/edx-platform$ pip list | grep "openedx-plugin-example"
# Empty...

Steps Tried:

I've tried to clone the openedx-plugin-example and bind-mount it as suggested in the depreciation note:

git clone https://github.com/cookiecutter-openedx/openedx-plugin-example
tutor mounts add openedx-plugin-example

This alone doesn't work, one needs to also tell Tutor to look for the mounted apps (as described here): Create a plugin.py file with the following:

from tutor import hooks

hooks.Filters.MOUNTED_DIRECTORIES.add_item(("openedx", "openedx-plugin-example"))

Copy this into the Tutor config:

cp plugin.py "$(tutor plugins printroot)"
tutor config save

tutor mounts list

- name: /Users/.../edx-platform
  build_mounts:
  - image: openedx
    context: edx-platform
  - image: openedx-dev
    context: edx-platform
  compose_mounts:
  - service: openedx
    container_path: /openedx/edx-platform
- name: /Users/.../openedx-plugin-example
  build_mounts:
  - image: openedx
    context: mnt-openedx-plugin-example
  - image: openedx-dev
    context: mnt-openedx-plugin-example
  compose_mounts:
  - service: openedx
    container_path: /mnt/openedx-plugin-example
  - service: openedx-dev
    container_path: /mnt/openedx-plugin-example

Running a tutor images build openedx and tutor local launch shows that the repo is mounted and installed: RUN pip install -e "/mnt/openedx-plugin-example"

However, running a pip list still doesn't show the package.

Notes:

I've read through your Cookiecutter blog post and looked into the hastexo/tutor-contrib-s3 plugin and I am able to pip install this package and it is added correctly to the python env in the Docker image. It is a good example of a Tutor plugin, however it only seems to set config and settings (whereas for my application I need to add some new endpoints to the djangoapps in the lms).

I hope the steps above help reproduce the issue I'm facing. Any guidance would be appreciated and I'd be happy to submit a PR if you have and suggestions on how to resolve. 👍

lpm0073 commented 2 months ago

@graeme44 thanks for posting this. what i've read recently, and seems to square with your issue above, is that tutor has changed the procedure for adding python requirements. until recently there'd been a file named "private.txt", but apparently that has been removed. i'm presently working on an unrelated project. if you can shed light on the new procedure for adding requirements then i can work out what needs to change within this repo.