What is the *best* approach for working with Python virtual environments in tutor dev?

I want to do the following in a local development environment: create a common python virtual environment that can be mounted on tutor dev, but that can also be activated in my development environment such that i can install/uninstall packages from the command line and hack package source code, and, the open edx lms/cms/workers reflect these changes as i make them.

I’ve experimented with both of the following:

  1. create a literal copy of the virtual environment created from the openedx Dockerfile by using a command of the form tutor dev copyfrom lms /openedx/venv ~
  2. create my own virtual environment by installing Python 3.8.12 and pip installing the necessary requirements files located in edx-platform/requirement/edx/

Either way, i’m mounting the virtual environment onto the containers with this command:

tutor dev start -d --mount=lms,lms-worker,lms-job:~/venv-openedx:/openedx/venv lms

When using the first approach i had to modify the pip and python executables as these are symlinks pointing to /opt/pyenv/versions/3.8.12/bin/python. I tried re-pointing the existing symlinks to the equivalent files on my file system but this breaks lms/cms. And, the 2nd approach results in a broken platform.

How are other edX developers approaching this?

Check out tutor-contrib-kdmccormick/quickdev.rst at master · kdmccormick/tutor-contrib-kdmccormick · GitHub which is brand new and I think does most of what you want.

1 Like

amazing! great contribution from @kmccormick – thanks man!!

No problem @lpm0073 , let me know if you run into any problems with it!