diff --git a/.github/workflows/auto-add-to-project.yml b/.github/workflows/auto-add-to-project.yml
new file mode 100644
index 0000000..ad870e2
--- /dev/null
+++ b/.github/workflows/auto-add-to-project.yml
@@ -0,0 +1,17 @@
+name: Auto Add Issues and Pull Requests to Project
+
+on:
+ issues:
+ types:
+ - opened
+
+jobs:
+ # https://github.com/actions/add-to-project
+ add-to-proje
+ name: Add issue and bugs to project
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/add-to-project@v0.5.0
+ with:
+ project-url: https://github.com/orgs/overhangio/projects/4
+ github-token: ${{ secrets.GH_PROJECT_PERSONAL_ACCESS_TOKEN }}
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4efbf80..220b548 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,6 @@ variables:
TUTOR_PLUGIN: discovery
TUTOR_IMAGES: discovery
TUTOR_PYPI_PACKAGE: tutor-discovery
- OPENEDX_RELEASE: palm
GITHUB_REPO: overhangio/tutor-discovery
include:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 46abd73..5b0971d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,20 @@ instructions, because git commits are used to generate release notes:
+
+## v17.0.0 (2023-12-09)
+
+- 💥 [Feature] Upgrade to Quince. (by @ziafazal)
+- [Bugfix] Fix missing pkg-config during image build. (by @regisb)
+- [Feature] Pull translations via `atlas` during Docker build. (by @OmarIthawi)
+
+
+## v16.0.2 (2023-12-09)
+
+- [Improvement] Added Typing to code, Makefile and test action to the repository and formatted code with Black and isort. (by @CodeWithEmad)
+- [Improvement] Introduced Course Discovery Repository and Version settings. (by @Faraz32123)
+- [BugFix] Fix base url for discovery media files, including program banner images. (by @Faraz32123)
+
## v16.0.1 (2023-11-08)
diff --git a/README.rst b/README.rst
index 0c47cd0..69ebb6b 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
-Course Discovery plugin for `Tutor `_
+Course Discovery plugin for `Tutor `_
=====================================================================
-This is a plugin for `Tutor `_ that integrates the `Course Discovery `__ application in an Open edX platform. it is useful for integration with, for example, `Ecommerce `__ or an external course catalog.
+This is a plugin for `Tutor `_ that integrates the `Course Discovery `__ application in an Open edX platform. it is useful for integration with, for example, `Ecommerce `__ or an external course catalog.
Installation
------------
@@ -14,15 +14,9 @@ Then, to enable this plugin, run::
tutor plugins enable discovery
-You will have to re-generate the environment::
+Restart and initialize your platform with::
- tutor config save
-
-Then, run migrations::
-
- tutor local init
-
-This last step is unnecessary if you run instead ``tutor local launch``.
+ tutor local launch
Operations
----------
@@ -30,11 +24,11 @@ Operations
Creating a user
~~~~~~~~~~~~~~~
-The discovery user interface will be available at http://discovery.local.overhang.io for a local test instance, and at ``DISCOVERY_HOST`` (by default: http(s)://discovery.) in production. In order to run commands from the UI, a user must be created::
+The discovery user interface will be available at http://discovery.local.edly.io for a local test instance, and at ``DISCOVERY_HOST`` (by default: http(s)://discovery.) in production. In order to run commands from the UI, a user must be created::
tutor local run discovery ./manage.py createsuperuser
-Then, you must login with this user at http://discovery.local.overhang.io/admin.
+Then, you must login with this user at http://discovery.local.edly.io/admin.
Alternatively, you can login with oauth2 using a pre-existing user created on the LMS/CMS by accessing http(s)://discovery./login. To do so, the proper domain names must exist and point to the production server.
@@ -71,13 +65,30 @@ Then run the below command, this command will cause errors every time as it trie
tutor local run lms ./manage.py lms cache_programs
-If you don't want the errors, then make use of an extra argument to the command .i.e. ``--domain``. This argument will be equal to ``local.overhang.io`` if you are running tutor local and ``local.overhang.io:8000`` if you are running tutor dev::
- tutor local run lms ./manage.py lms cache_programs --domain="local.overhang.io"
+If you don't want the errors, then make use of an extra argument to the command .i.e. ``--domain``. This argument will be equal to ``local.edly.io`` if you are running tutor local and ``local.edly.io:8000`` if you are running tutor dev::
+ tutor local run lms ./manage.py lms cache_programs --domain="local.edly.io"
or
- tutor dev run lms ./manage.py lms cache_programs --domain="local.overhang.io:8000"
+ tutor dev run lms ./manage.py lms cache_programs --domain="local.edly.io:8000"
This last step should be performed every time you create new or make changes to existing programs.
+Show Programs Tab
+~~~~~~~~~~~~~~~~
+
+In order to show programs tab in the LMS dashboard, users will need to manually create an entry in ``Programs api config`` model in LMS Admin Panel. Go to http://local.edly.io/admin/programs/programsapiconfig/. Add ``Marketing path`` equal to ``/programs`` and enable it. Then Programs tab will be shown on the LMS where users can view their registered programs. It will show like as in below picture.
+
+.. image:: https://github.com/overhangio/tutor-discovery/assets/122095701/e0224011-adc0-41e4-a104-af4cb0c24b82
+ :alt: Programs Tab on LMS dashboard
+
+In the above image, User can see explore programs button which is pointing to ``http://localhost:8080/programs`` by default. This link does not exist. So, users can change this link to their custom build marketing site url to show all programs there. This can be done by modifying ``Site Configurations`` model in LMS Admin Panel. Go to http://local.edly.io/site_configuration/siteconfiguration/. Open respective LMS site configuration and add below dict in ``site values`` field like below image::
+
+ "MKTG_URLS": {
+ "ROOT": "https://custom-marketing-site-here.com"
+ }
+
+.. image:: https://github.com/overhangio/tutor-discovery/assets/122095701/2d588ea9-a830-40b6-9845-8fab56d7cb5a
+ :alt: Add Custom Site for Explore Programs
+
Install extra requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -97,7 +108,7 @@ To debug the course discovery service, you are encouraged to mount the course-di
tutor dev start --mount /path/to/course-discovery/ discovery
-You can then access the development server at http://discovery.local.overhang.io:8381. Feel free to add breakpoints (``import pdb; pdb.set_trace()``) anywhere in your source code to debug your application.
+You can then access the development server at http://discovery.local.edly.io:8381. Feel free to add breakpoints (``import pdb; pdb.set_trace()``) anywhere in your source code to debug your application.
Once a local repository is mounted in the image, you will have to install nodejs dependencies and collect static assets::
@@ -107,7 +118,7 @@ Once a local repository is mounted in the image, you will have to install nodejs
Troubleshooting
---------------
-This Tutor plugin is maintained by Muhammad Faraz Maqsood from `Edly `__. Community support is available from the official `Open edX forum `__. Do you need help with this plugin? See the `troubleshooting `__ section from the Tutor documentation.
+This Tutor plugin is maintained by Muhammad Faraz Maqsood from `Edly `__. Community support is available from the official `Open edX forum `__. Do you need help with this plugin? See the `troubleshooting `__ section from the Tutor documentation.
`Max retries exceeded with url`
diff --git a/changelog.d/20231005_153602_codewithemad.md b/changelog.d/20231005_153602_codewithemad.md
deleted file mode 100644
index 952a383..0000000
--- a/changelog.d/20231005_153602_codewithemad.md
+++ /dev/null
@@ -1 +0,0 @@
-- [Improvement] Added Typing to code, Makefile and test action to the repository and formatted code with Black and isort. (by @CodeWithEmad)
\ No newline at end of file
diff --git a/changelog.d/20231113_125255_faraz.maqsood_introduce_course_discovery_repository_settings.md b/changelog.d/20231113_125255_faraz.maqsood_introduce_course_discovery_repository_settings.md
deleted file mode 100644
index 63cc321..0000000
--- a/changelog.d/20231113_125255_faraz.maqsood_introduce_course_discovery_repository_settings.md
+++ /dev/null
@@ -1 +0,0 @@
-- [Improvement] Introduced Course Discovery Repository and Version settings. (by @Faraz32123)
\ No newline at end of file
diff --git a/changelog.d/20240212_115536_regis_pkg_resources.md b/changelog.d/20240212_115536_regis_pkg_resources.md
new file mode 100644
index 0000000..35b6d20
--- /dev/null
+++ b/changelog.d/20240212_115536_regis_pkg_resources.md
@@ -0,0 +1 @@
+- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb)
diff --git a/setup.py b/setup.py
index 128377a..df41c83 100644
--- a/setup.py
+++ b/setup.py
@@ -17,9 +17,9 @@
setup(
name="tutor-discovery",
version=about["__version__"],
- url="https://docs.tutor.overhang.io/",
+ url="https://docs.tutor.edly.io/",
project_urls={
- "Documentation": "https://docs.tutor.overhang.io/",
+ "Documentation": "https://docs.tutor.edly.io/",
"Code": "https://github.com/overhangio/tutor-discovery",
"Issue tracker": "https://github.com/overhangio/tutor-discovery/issues",
"Community": "https://discuss.openedx.org",
@@ -34,7 +34,8 @@
long_description_content_type="text/x-rst",
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
- install_requires=["tutor>=16.0.0,<17.0.0"],
+ install_requires=["tutor>=17.0.0,<18.0.0"],
+ extras_require={"dev": "tutor[dev]>=17.0.0,<18.0.0"},
python_requires=">=3.8",
entry_points={"tutor.plugin.v1": ["discovery = tutordiscovery.plugin"]},
classifiers=[
diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py
index 610c111..a08b09c 100644
--- a/tutordiscovery/__about__.py
+++ b/tutordiscovery/__about__.py
@@ -1 +1 @@
-__version__ = "16.0.1"
+__version__ = "17.0.0"
diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py
index c5c0893..5fcdc22 100644
--- a/tutordiscovery/plugin.py
+++ b/tutordiscovery/plugin.py
@@ -4,7 +4,7 @@
import typing as t
from glob import glob
-import pkg_resources
+import importlib_resources
from tutor import hooks as tutor_hooks
from tutor.__about__ import __version_suffix__
@@ -31,6 +31,8 @@
"OAUTH2_KEY_SSO": "discovery-sso",
"OAUTH2_KEY_SSO_DEV": "discovery-sso-dev",
"CACHE_REDIS_DB": "{{ OPENEDX_CACHE_REDIS_DB }}",
+ "ATLAS_PULL": False,
+ "DEFAULT_PRODUCT_SOURCE_SLUG": "edx",
"EXTRA_PIP_REQUIREMENTS": [],
"REPOSITORY": "https://github.com/openedx/course-discovery.git",
"REPOSITORY_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
@@ -48,7 +50,7 @@
for service in init_tasks:
with open(
os.path.join(
- pkg_resources.resource_filename("tutordiscovery", "templates"),
+ str(importlib_resources.files("tutordiscovery") / "templates"),
"discovery",
"tasks",
service,
@@ -110,7 +112,7 @@ def _mount_course_discovery_on_build(
# Add the "templates" folder as a template root
tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
- pkg_resources.resource_filename("tutordiscovery", "templates")
+ str(importlib_resources.files("tutordiscovery") / "templates")
)
# Render the "build" and "apps" folders
tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
@@ -122,7 +124,7 @@ def _mount_course_discovery_on_build(
# Load patches from files
for path in glob(
os.path.join(
- pkg_resources.resource_filename("tutordiscovery", "patches"),
+ str(importlib_resources.files("tutordiscovery") / "patches"),
"*",
)
):
diff --git a/tutordiscovery/templates/discovery/apps/settings/partials/common.py b/tutordiscovery/templates/discovery/apps/settings/partials/common.py
index ae2ef61..4cd4758 100644
--- a/tutordiscovery/templates/discovery/apps/settings/partials/common.py
+++ b/tutordiscovery/templates/discovery/apps/settings/partials/common.py
@@ -47,6 +47,7 @@
PARLER_LANGUAGES["default"]["fallbacks"] = [PARLER_DEFAULT_LANGUAGE_CODE]
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
+DEFAULT_PRODUCT_SOURCE_SLUG = "{{ DISCOVERY_DEFAULT_PRODUCT_SOURCE_SLUG }}"
EMAIL_HOST = "{{ SMTP_HOST }}"
EMAIL_PORT = "{{ SMTP_PORT }}"
EMAIL_HOST_USER = "{{ SMTP_USERNAME }}"
diff --git a/tutordiscovery/templates/discovery/apps/settings/tutor/development.py b/tutordiscovery/templates/discovery/apps/settings/tutor/development.py
index 9de215e..9ec0bf9 100644
--- a/tutordiscovery/templates/discovery/apps/settings/tutor/development.py
+++ b/tutordiscovery/templates/discovery/apps/settings/tutor/development.py
@@ -16,4 +16,7 @@
# Disable API caching, which makes it a pain to troubleshoot issues
USE_API_CACHING = False
+DISCOVERY_BASE_URL = "http://{{ DISCOVERY_HOST }}:8381"
+MEDIA_URL = DISCOVERY_BASE_URL + "/media/"
+
{{ patch("discovery-development-settings") }}
diff --git a/tutordiscovery/templates/discovery/apps/settings/tutor/production.py b/tutordiscovery/templates/discovery/apps/settings/tutor/production.py
index a3b0859..f0843af 100644
--- a/tutordiscovery/templates/discovery/apps/settings/tutor/production.py
+++ b/tutordiscovery/templates/discovery/apps/settings/tutor/production.py
@@ -15,4 +15,7 @@
SOCIAL_AUTH_REDIRECT_IS_HTTPS = {% if ENABLE_HTTPS %}True{% else %}False{% endif %}
+DISCOVERY_BASE_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}"
+MEDIA_URL = DISCOVERY_BASE_URL + "/media/"
+
{{ patch("discovery-production-settings") }}
diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile
index 5575ec6..dbc66e8 100644
--- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile
+++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile
@@ -1,13 +1,14 @@
-{% if is_buildkit_enabled() %}# syntax=docker/dockerfile:1.4{% endif %}
+# syntax=docker/dockerfile:1.4
###### Minimal image with base system requirements for most stages
FROM docker.io/ubuntu:20.04 as minimal
ENV DEBIAN_FRONTEND=noninteractive
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \
- --mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \
+RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
+ --mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
- apt install -y curl git-core language-pack-en python3 python3-pip python3-venv \
- build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev
+ apt install -y curl git-core gettext language-pack-en python3 python3-dev python3-pip python3-venv \
+ build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev \
+ pkg-config
ENV LC_ALL en_US.UTF-8
ARG APP_USER_ID=1000
@@ -30,14 +31,14 @@ ENV DISCOVERY_CFG /openedx/config.yml
RUN python3 -m venv ../venv/
ENV PATH "/openedx/venv/bin:$PATH"
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install \
+RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
- setuptools==67.7.2 pip==23.1.2. wheel==0.40.0
+ setuptools==68.2.2 pip==23.2.1. wheel==0.41.2
# Install a recent version of nodejs
-RUN pip install nodeenv==1.7.0
+RUN pip install nodeenv==1.8.0
# nodejs version picked from https://github.com/openedx/course-discovery/blob/master/Dockerfile
RUN nodeenv /openedx/nodeenv --node=16.14.2 --prebuilt
ENV PATH /openedx/nodeenv/bin:${PATH}
@@ -46,21 +47,27 @@ ENV PATH /openedx/nodeenv/bin:${PATH}
# This is identical to "make production-requirements" but it was split in multiple
# instructions to benefit from docker image caching
# Install base requirements
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install -r requirements.txt
-{% for extra_requirement in DISCOVERY_EXTRA_PIP_REQUIREMENTS %}RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install '{{ extra_requirement }}'
+RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements.txt
+{% for extra_requirement in DISCOVERY_EXTRA_PIP_REQUIREMENTS %}RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install '{{ extra_requirement }}'
{% endfor %}
# Install npm, bower requirements
ARG NPM_REGISTRY='{{ NPM_REGISTRY }}'
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.npm/,sharing=shared,uid=${APP_USER_ID} {% endif %}npm clean-install --verbose --no-audit --registry=$NPM_REGISTRY --production
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USER_ID} {% endif %}./node_modules/.bin/bower install --allow-root --production
+RUN --mount=type=cache,target=/openedx/.npm/,sharing=shared,uid=${APP_USER_ID} npm clean-install --verbose --no-audit --registry=$NPM_REGISTRY --production
+RUN --mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USER_ID} ./node_modules/.bin/bower install --allow-root --production
# Install extra requirements
-RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install \
+RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# Use redis as a django cache https://pypi.org/project/django-redis/
- django-redis==5.2.0 \
+ django-redis==5.4.0 \
# uwsgi server https://pypi.org/project/uWSGI/
- uwsgi==2.0.21
+ uwsgi==2.0.22
+
+{% if DISCOVERY_ATLAS_PULL %}
+# Pull translations. Support the OEP-58 proposal behind a feature flag until it's fully implemented.
+RUN atlas pull {{ patch("atlas-extra-args") }} translations/course-discovery/course_discovery/conf/locale:course_discovery/conf/locale
+RUN python manage.py compilemessages
+{% endif %}
# Collect static assets
COPY --chown=app:app assets.py ./course_discovery/settings/assets.py