Skip to content

Commit 683f43c

Browse files
committed
feat: dev pkg improvements (WIP)
1 parent bbab35e commit 683f43c

File tree

5 files changed

+76
-9
lines changed

5 files changed

+76
-9
lines changed

tutor/templates/build/openedx/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ RUN pip install uwsgi==2.0.21
9191

9292
# Install private requirements: this is useful for installing custom xblocks.
9393
COPY ./requirements/ /openedx/requirements
94-
RUN cd /openedx/requirements/ \
95-
&& touch ./private.txt \
96-
&& pip install -r ./private.txt
94+
COPY ./bin/pip-install-all /openedx/bin/pip-install-all
95+
RUN chmod a+x /openedx/bin/pip-install-all
96+
RUN /openedx/bin/pip-install-all /openedx/requirements
9797

9898
{% for extra_requirements in OPENEDX_EXTRA_PIP_REQUIREMENTS %}RUN pip install '{{ extra_requirements }}'
9999
{% endfor %}
@@ -224,6 +224,10 @@ RUN pip install -r requirements/edx/development.txt
224224
# https://pypi.org/project/ipython
225225
RUN pip install ipdb==0.13.9 ipython==8.7.0
226226

227+
# Install private development-only requirements
228+
COPY ./requirements-dev /openedx/requirements-dev
229+
RUN /openedx/bin/pip-install-all /openedx/requirements-dev
230+
227231
# Add ipdb as default PYTHONBREAKPOINT
228232
ENV PYTHONBREAKPOINT=ipdb.set_trace
229233

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
# TODO: Document this
3+
4+
set -eu
5+
6+
script="$(basename "$0")"
7+
8+
if [ $# != 1 ] ; then
9+
echo "$script: error: expected exactly one argument: a directory."
10+
exit 1
11+
fi
12+
13+
dir="$1"
14+
15+
if [ ! -d "$dir" ] ; then
16+
echo "$script: error: not a directory: $dir"
17+
exit 1
18+
fi
19+
20+
if [ -z "$(ls -A "$dir")" ] ; then
21+
echo "$script: $dir is empty; nothing to do"
22+
exit 0
23+
fi
24+
25+
for dir_item in "$dir"/* ; do
26+
if [ ! -d "$dir_item" ] ; then
27+
# skip regular files
28+
continue
29+
fi
30+
# TODO: Is it right to always do editable (-e) install?
31+
# Should we make it configurable?
32+
set -x
33+
pip install -e "$dir_item"
34+
set +x
35+
done
36+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
requirements-dev
2+
################
3+
4+
If you want to install a local Python package into the openedx-dev image, then:
5+
6+
1. Move it into this directory.
7+
2. Reboot your development platform (``tutor dev reboot``). This will trigger the openedx-dev image to be rebuilt and containers to be recreated.
8+
9+
Going forward, changes to the local package's code should be automatically manifested.
10+
11+
To remove the local package, simply:
12+
13+
1. Move it out of this directory.
14+
2. Reboot your development platform (``tutor dev reboot``).
15+
16+
Please note: This strategy will only affect the image for the Open edX development (``tutor dev``) environment. To install a package into all environments (``tutor dev``, ``tutor local``, ``tutor k8s``), use the `../requirements`_ directory instead.
17+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
requirements
2+
############
3+
4+
If you want to install a local Python package into the openedx image, then:
5+
6+
1. Move it into this directory.
7+
2. Reboot your platform (``tutor local/k8s/dev reboot``). This will trigger the openedx image to be rebuilt and containers to be recreated.
8+
9+
Going forward, changes to the local package's code should be automatically manifested.
10+
11+
To remove the local package, simply:
12+
13+
1. Move it out of this directory.
14+
2. Reboot your platform (``tutor local/k8s/dev reboot``).
15+
16+
Tip: If you are only testing out a local package with your development environment (``tutor dev``), then you can save image build time by using `../requirements-dev`_ instead.

tutor/templates/build/openedx/requirements/private-sample.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)