From d2d72b2d9fc0e12a31575e7d05b8fdef934b0b1d Mon Sep 17 00:00:00 2001 From: Carlos Muniz Date: Tue, 20 Sep 2022 15:59:22 -0400 Subject: [PATCH 01/22] docs: change quickstart to launch This change is due to renaming quickstart to launch in tutor. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fecb0ff..f5d0716 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ Then, run migrations:: tutor local init -This last step is unnecessary if you run instead ``tutor local quickstart``. +This last step is unnecessary if you run instead ``tutor local launch``. Operations ---------- From 6bbb79e11f1a2df4638a7fb45e3d3576240efb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 10 Nov 2022 15:51:28 +0100 Subject: [PATCH 02/22] ci: fix nutmeg target --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15ae182..39523a2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TUTOR_PLUGIN: discovery TUTOR_IMAGES: discovery TUTOR_PYPI_PACKAGE: tutor-discovery - OPENEDX_RELEASE: maple + OPENEDX_RELEASE: nutmeg GITHUB_REPO: overhangio/tutor-discovery include: From 8cdb63b4f70dc349df9f123e97843cdcd05c4886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 21 Nov 2022 16:55:38 +0100 Subject: [PATCH 03/22] v14.0.2wq --- tutordiscovery/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 4fcf9b8..897518d 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1 @@ -__version__ = "14.0.1" +__version__ = "14.0.2" From 6a1840388fdb3564c024534db115a1c20e8c9f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 21 Nov 2022 16:55:38 +0100 Subject: [PATCH 04/22] v14.0.2 --- tutordiscovery/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 4fcf9b8..897518d 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1 @@ -__version__ = "14.0.1" +__version__ = "14.0.2" From 36d0e80625977cc4be4a246fc7d4e1438f1a25c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 21 Nov 2022 16:55:38 +0100 Subject: [PATCH 05/22] v14.0.2 --- tutordiscovery/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 4fcf9b8..897518d 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1 @@ -__version__ = "14.0.1" +__version__ = "14.0.2" From aa9053c49f97fb970e13aca4f2b45d6479f436db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 10 Nov 2022 15:51:07 +0100 Subject: [PATCH 06/22] feat: upgrade to olive --- .gitlab-ci.yml | 2 +- README.rst | 22 ++++++++++-- setup.py | 4 +-- tutordiscovery/__about__.py | 3 +- tutordiscovery/plugin.py | 36 +++++++++---------- .../discovery/build/discovery/Dockerfile | 6 ++-- 6 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39523a2..36126c1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TUTOR_PLUGIN: discovery TUTOR_IMAGES: discovery TUTOR_PYPI_PACKAGE: tutor-discovery - OPENEDX_RELEASE: nutmeg + OPENEDX_RELEASE: olive GITHUB_REPO: overhangio/tutor-discovery include: diff --git a/README.rst b/README.rst index 078b77b..8c165b2 100644 --- a/README.rst +++ b/README.rst @@ -32,7 +32,7 @@ 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:: - tutor local run discovery ./manage.py createsuperuser + tutor local run discovery ./manage.py createsuperuser Then, you must login with this user at http://discovery.local.overhang.io/admin. @@ -55,8 +55,8 @@ Re-indexing courses :: - tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx - tutor local run discovery ./manage.py update_index --disable-change-limit + tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx + tutor local run discovery ./manage.py update_index --disable-change-limit Caching programs ~~~~~~~~~~~~~~~~ @@ -92,6 +92,22 @@ Troubleshooting This Tutor plugin is maintained by Régis Behmo from `Overhang.IO `__. 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` ++++++++++++++++++++++++++++++++ + +When running in production with HTTPS enabled, you may face this error during the `init` phase of `tutor local launch`: + +``` +requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=10&username=discovery +``` + +This error may be due to an incorrect DNS resolution of the LMS DNS record. With some cloud providers (for instance: [DigitalOcean](https://digitalocean.com/)) the `/etc/hosts` file on the host automatically contains the following entry:: + + 127.0.1.1 + +This entry may be present if you named your server with the LMS hostname. + License ------- diff --git a/setup.py b/setup.py index 01a791f..c85f233 100644 --- a/setup.py +++ b/setup.py @@ -33,8 +33,8 @@ long_description=readme, packages=find_packages(exclude=["tests*"]), include_package_data=True, - install_requires=["tutor>=14.0.0,<15.0.0"], - python_requires=">=3.5", + install_requires=["tutor>=15.0.0,<16.0.0"], + python_requires=">=3.7", entry_points={"tutor.plugin.v1": ["discovery = tutordiscovery.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 897518d..1aa815c 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1,2 @@ -__version__ = "14.0.2" +__version__ = "15.0.0" + diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index fbb6b10..56fab18 100644 --- a/tutordiscovery/plugin.py +++ b/tutordiscovery/plugin.py @@ -32,24 +32,24 @@ } # Initialization tasks -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "mysql", - ("discovery", "tasks", "mysql", "init"), - ) -) -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "lms", - ("discovery", "tasks", "lms", "init"), - ) -) -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "discovery", - ("discovery", "tasks", "discovery", "init"), - ) -) +init_tasks = ("mysql", "lms", "discovery") +for service in init_tasks: + with open( + os.path.join( + pkg_resources.resource_filename("tutordiscovery", "templates"), + "discovery", + "tasks", + service, + "init", + ), + encoding="utf8", + ) as fi: + tutor_hooks.Filters.CLI_DO_INIT_TASKS.add_item( + ( + service, + fi.read(), + ) + ) # Image management tutor_hooks.Filters.IMAGES_BUILD.add_item( diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index dc74092..7e0f30d 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -3,7 +3,7 @@ FROM docker.io/ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ apt install -y curl git-core language-pack-en python3 python3-pip python3-venv \ - build-essential libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev + build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev ENV LC_ALL en_US.UTF-8 ARG APP_USER_ID=1000 @@ -26,7 +26,7 @@ ENV PATH "/openedx/venv/bin:$PATH" # https://pypi.org/project/setuptools/ # https://pypi.org/project/pip/ # https://pypi.org/project/wheel/ -RUN pip install setuptools==62.1.0 pip==22.0.4 wheel==0.37.1 +RUN pip install setuptools==65.5.1 pip==22.3.1 wheel==0.38.4 # Install a recent version of nodejs RUN pip install nodeenv @@ -48,7 +48,7 @@ RUN pip install django-redis==5.2.0 # Install uwsgi # https://pypi.org/project/uWSGI/ -RUN pip install uwsgi==2.0.20 +RUN pip install uwsgi==2.0.21 # Collect static assets COPY --chown=app:app assets.py ./course_discovery/settings/assets.py From e8cf712a0b3848a8d0b1fdc19b29a0a98e32000b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Fri, 26 May 2023 18:26:28 +0200 Subject: [PATCH 07/22] feat: label nightly version This is to address https://github.com/overhangio/tutor-mfe/issues/122 As a consequence of this change, images will be tagged with a "-nightly" suffix. Next, we'll probably have to build them periodically in CI. --- tutordiscovery/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 9d7ed14..fb99bb0 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1,7 +1,7 @@ __version__ = "15.0.0" # Handle version suffix for nightly, just like tutor core. -__version_suffix__ = "" +__version_suffix__ = "nightly" if __version_suffix__: __version__ += "-" + __version_suffix__ From f09d6140ecbd4d9a30eca364af581a481e517936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Fri, 26 May 2023 18:47:48 +0200 Subject: [PATCH 08/22] fix: nightly package version The package version number may not include the "-nightly" suffix. Otherwise, installation fails with: setuptools.extern.packaging.version.InvalidVersion: Invalid version: '15.0.7-nightly' --- setup.py | 2 +- tutordiscovery/__about__.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 183f853..4cfb21d 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="tutor-discovery", - version=about["__version__"], + version=about["__package_version__"], url="https://docs.tutor.overhang.io/", project_urls={ "Documentation": "https://docs.tutor.overhang.io/", diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index fb99bb0..e9a61d4 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1,4 +1,5 @@ __version__ = "15.0.0" +__package_version__ = __version__ # Handle version suffix for nightly, just like tutor core. __version_suffix__ = "nightly" From 21b82de63ffdec4c8c78fcd766aac4a436fc2ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Fri, 8 Sep 2023 09:53:08 +0200 Subject: [PATCH 09/22] fix: missing pkg-config in image build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build was failing with the following error during the installation of mysqlclient==2.2.0: #39 22.19 Collecting mysqlclient==2.2.0 (from -r requirements/production.txt (line 435)) #39 22.20 Downloading mysqlclient-2.2.0.tar.gz (89 kB) #39 22.20 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 95.8 MB/s eta 0:00:00 #39 22.24 Installing build dependencies: started #39 24.79 Installing build dependencies: finished with status 'done' #39 24.81 Getting requirements to build wheel: started #39 25.07 Getting requirements to build wheel: finished with status 'error' #39 25.08 error: subprocess-exited-with-error #39 25.08 #39 25.08 × Getting requirements to build wheel did not run successfully. #39 25.08 │ exit code: 1 #39 25.08 ╰─> [24 lines of output] #39 25.08 /bin/sh: 1: pkg-config: not found #39 25.08 /bin/sh: 1: pkg-config: not found #39 25.08 Trying pkg-config --exists mysqlclient #39 25.08 Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127. #39 25.08 Trying pkg-config --exists mariadb #39 25.08 Command 'pkg-config --exists mariadb' returned non-zero exit status 127. #39 25.08 Traceback (most recent call last): #39 25.08 File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in #39 25.08 main() #39 25.08 File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main #39 25.08 json_out['return_val'] = hook(**hook_input['kwargs']) #39 25.08 File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel #39 25.08 return hook(config_settings) #39 25.08 File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel #39 25.08 return self._get_build_requires(config_settings, requirements=['wheel']) #39 25.08 File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires #39 25.08 self.run_setup() #39 25.08 File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in run_setup #39 25.08 exec(code, locals()) #39 25.08 File "", line 154, in #39 25.08 File "", line 48, in get_config_posix #39 25.08 File "", line 27, in find_package_name #39 25.08 Exception: Can not find valid pkg-config name. #39 25.08 Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually #39 25.08 [end of output] --- changelog.d/20230908_095220_regis_nightly.md | 1 + .../templates/discovery/build/discovery/Dockerfile | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelog.d/20230908_095220_regis_nightly.md diff --git a/changelog.d/20230908_095220_regis_nightly.md b/changelog.d/20230908_095220_regis_nightly.md new file mode 100644 index 0000000..954a6ea --- /dev/null +++ b/changelog.d/20230908_095220_regis_nightly.md @@ -0,0 +1 @@ +- [Bugfix] Fix missing pkg-config during image build. (by @regisb) diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index 92fa176..9c5b80a 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -4,10 +4,11 @@ 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 %} \ + --mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \ 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 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 From b9dd9409032fb9df370d509d5a44004817ca6397 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Wed, 2 Aug 2023 09:07:00 +0300 Subject: [PATCH 10/22] feat: add minimal `atlas` step to the build This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification). --- changelog.d/20230909_160414_i_atlas.md | 1 + tutordiscovery/plugin.py | 1 + .../templates/discovery/build/discovery/Dockerfile | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20230909_160414_i_atlas.md diff --git a/changelog.d/20230909_160414_i_atlas.md b/changelog.d/20230909_160414_i_atlas.md new file mode 100644 index 0000000..d0fa4a7 --- /dev/null +++ b/changelog.d/20230909_160414_i_atlas.md @@ -0,0 +1 @@ +- [Feature] Pull translations via `atlas` during Docker build. (by @OmarIthawi) diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index 3e36638..7e73ee8 100644 --- a/tutordiscovery/plugin.py +++ b/tutordiscovery/plugin.py @@ -31,6 +31,7 @@ "OAUTH2_KEY_SSO": "discovery-sso", "OAUTH2_KEY_SSO_DEV": "discovery-sso-dev", "CACHE_REDIS_DB": "{{ OPENEDX_CACHE_REDIS_DB }}", + "ATLAS_PULL": False, "EXTRA_PIP_REQUIREMENTS": [], }, } diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index 9c5b80a..c0499d9 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -6,7 +6,7 @@ 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 %} \ apt update && \ - apt install -y curl git-core language-pack-en python3 python3-dev python3-pip python3-venv \ + 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 @@ -61,7 +61,15 @@ RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip, # Use redis as a django cache https://pypi.org/project/django-redis/ django-redis==5.2.0 \ # uwsgi server https://pypi.org/project/uWSGI/ - uwsgi==2.0.21 + uwsgi==2.0.21 \ + # Open edX Atlas tranlsation management tool https://pypi.org/project/openedx-atlas/ + openedx-atlas==0.5.0 + +{% 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 From 03c43e084cd4269ed06d21a6c85b33600bb3d1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 5 Dec 2023 11:45:48 +0100 Subject: [PATCH 11/22] docs: docs.tutor.overhang.io -> docs.tutor.edly.io See: https://github.com/overhangio/tutor/issues/945 --- README.rst | 6 +++--- setup.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 0c47cd0..f24ed39 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 ------------ @@ -107,7 +107,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/setup.py b/setup.py index 128377a..5413899 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", From e766c92c86bec03388eae648fcc57c6215b72852 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Sat, 18 Nov 2023 08:24:48 +0300 Subject: [PATCH 12/22] chore: use course-discovery openedx-atlas requirement course-discovery now maintains its own base.in requirement for atlas the tutor-discovery no longer needs to install it. --- tutordiscovery/templates/discovery/build/discovery/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index 75c0823..e7cfc4a 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -61,9 +61,7 @@ RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip, # Use redis as a django cache https://pypi.org/project/django-redis/ django-redis==5.2.0 \ # uwsgi server https://pypi.org/project/uWSGI/ - uwsgi==2.0.21 \ - # Open edX Atlas tranlsation management tool https://pypi.org/project/openedx-atlas/ - openedx-atlas==0.5.0 + uwsgi==2.0.21 {% if DISCOVERY_ATLAS_PULL %} # Pull translations. Support the OEP-58 proposal behind a feature flag until it's fully implemented. From 5f964b0c6c766b790e4567338043541c52f7ba15 Mon Sep 17 00:00:00 2001 From: Emad Rad Date: Fri, 8 Dec 2023 22:04:06 +0330 Subject: [PATCH 13/22] fix: dev dependency --- .github/workflows/test.yml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2ff802d..829f613 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,6 @@ jobs: run: python -m pip install --upgrade pip setuptools - name: Install dependencies run: | - pip install 'tutor[dev]>=16.0.0,<17.0.0' + pip install .[dev] - name: Test lint, types, and format run: make test diff --git a/setup.py b/setup.py index 5413899..79ac5da 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ packages=find_packages(exclude=["tests*"]), include_package_data=True, install_requires=["tutor>=16.0.0,<17.0.0"], + extras_require={"dev": "tutor[dev]>=16.0.0,<17.0.0"}, python_requires=">=3.8", entry_points={"tutor.plugin.v1": ["discovery = tutordiscovery.plugin"]}, classifiers=[ From 7dc8b266b69dab15948173b934b2ba60f9796347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Sat, 9 Dec 2023 15:54:28 +0100 Subject: [PATCH 14/22] local.overhang.io -> local.edly.io This is related to https://github.com/overhangio/tutor/issues/945 --- README.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index f24ed39..15d684f 100644 --- a/README.rst +++ b/README.rst @@ -30,11 +30,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,10 +71,10 @@ 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. @@ -97,7 +97,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:: From e30a78936d63439bde069aeff11960585bd81592 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Fri, 8 Dec 2023 17:52:22 +0500 Subject: [PATCH 15/22] fix: banner image base urls close #46 --- ..._172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md | 1 + .../templates/discovery/apps/settings/tutor/development.py | 3 +++ .../templates/discovery/apps/settings/tutor/production.py | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md diff --git a/changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md b/changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md new file mode 100644 index 0000000..d8a6c7e --- /dev/null +++ b/changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md @@ -0,0 +1 @@ +- [BugFix] Fix base url for discovery media files, including program banner images. (by @Faraz32123) 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") }} From 18cce706a794c4968e713f0f72c6b912a2ff1e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Sat, 9 Dec 2023 19:05:52 +0100 Subject: [PATCH 16/22] v16.0.2 --- CHANGELOG.md | 7 +++++++ changelog.d/20231005_153602_codewithemad.md | 1 - ...qsood_introduce_course_discovery_repository_settings.md | 1 - ...458_faraz.maqsood_faraz_fix_base_url_for_media_links.md | 1 - tutordiscovery/__about__.py | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) delete mode 100644 changelog.d/20231005_153602_codewithemad.md delete mode 100644 changelog.d/20231113_125255_faraz.maqsood_introduce_course_discovery_repository_settings.md delete mode 100644 changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 46abd73..7544ff3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes: + +## 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/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/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md b/changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md deleted file mode 100644 index d8a6c7e..0000000 --- a/changelog.d/20231208_172458_faraz.maqsood_faraz_fix_base_url_for_media_links.md +++ /dev/null @@ -1 +0,0 @@ -- [BugFix] Fix base url for discovery media files, including program banner images. (by @Faraz32123) diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 610c111..eabf3d3 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1 @@ -__version__ = "16.0.1" +__version__ = "16.0.2" From 52af6adb578716c0951c30f0fe394c9f7e653538 Mon Sep 17 00:00:00 2001 From: Zia Fazal Date: Fri, 10 Nov 2023 11:39:46 +0500 Subject: [PATCH 17/22] feat: upgrade to quince --- .gitlab-ci.yml | 2 +- CHANGELOG.md | 7 +++++ README.rst | 10 ++----- changelog.d/20230908_095220_regis_nightly.md | 1 - changelog.d/20230909_160414_i_atlas.md | 1 - setup.py | 4 +-- tutordiscovery/__about__.py | 2 +- tutordiscovery/plugin.py | 1 + .../apps/settings/partials/common.py | 1 + .../discovery/build/discovery/Dockerfile | 26 +++++++++---------- 10 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 changelog.d/20230908_095220_regis_nightly.md delete mode 100644 changelog.d/20230909_160414_i_atlas.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4efbf80..5846bc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TUTOR_PLUGIN: discovery TUTOR_IMAGES: discovery TUTOR_PYPI_PACKAGE: tutor-discovery - OPENEDX_RELEASE: palm + OPENEDX_RELEASE: quince GITHUB_REPO: overhangio/tutor-discovery include: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7544ff3..5b0971d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ 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) diff --git a/README.rst b/README.rst index 15d684f..c32c34d 100644 --- a/README.rst +++ b/README.rst @@ -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 ---------- diff --git a/changelog.d/20230908_095220_regis_nightly.md b/changelog.d/20230908_095220_regis_nightly.md deleted file mode 100644 index 954a6ea..0000000 --- a/changelog.d/20230908_095220_regis_nightly.md +++ /dev/null @@ -1 +0,0 @@ -- [Bugfix] Fix missing pkg-config during image build. (by @regisb) diff --git a/changelog.d/20230909_160414_i_atlas.md b/changelog.d/20230909_160414_i_atlas.md deleted file mode 100644 index d0fa4a7..0000000 --- a/changelog.d/20230909_160414_i_atlas.md +++ /dev/null @@ -1 +0,0 @@ -- [Feature] Pull translations via `atlas` during Docker build. (by @OmarIthawi) diff --git a/setup.py b/setup.py index 79ac5da..df41c83 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +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"], - extras_require={"dev": "tutor[dev]>=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 eabf3d3..a08b09c 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1 @@ -__version__ = "16.0.2" +__version__ = "17.0.0" diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index 58b297e..a889c12 100644 --- a/tutordiscovery/plugin.py +++ b/tutordiscovery/plugin.py @@ -32,6 +32,7 @@ "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 }}", 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/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index e7cfc4a..dbc66e8 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -1,10 +1,10 @@ -{% 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 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 \ @@ -31,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} @@ -47,21 +47,21 @@ 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. From 74273e027ff1d39dcf5493c84b29089ad3bfdc3c Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Tue, 9 Jan 2024 10:54:47 +0500 Subject: [PATCH 18/22] doc: add instructions related to programs close overhangio#42 as this is not an issue, updating readme in case of confusion. --- README.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.rst b/README.rst index c32c34d..69ebb6b 100644 --- a/README.rst +++ b/README.rst @@ -72,6 +72,23 @@ If you don't want the errors, then make use of an extra argument to the command 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~ From d451ab6425755be2f8f1dcc726d18d81dc2feea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Fri, 12 Jan 2024 12:33:35 +0100 Subject: [PATCH 19/22] ci: auto-add issues and items to github project --- .github/workflows/auto-add-to-project.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/auto-add-to-project.yml diff --git a/.github/workflows/auto-add-to-project.yml b/.github/workflows/auto-add-to-project.yml new file mode 100644 index 0000000..d4ab7a4 --- /dev/null +++ b/.github/workflows/auto-add-to-project.yml @@ -0,0 +1,20 @@ +name: Auto Add Issues and Pull Requests to Project + +on: + pull_request: + types: + - opened + issues: + types: + - opened + +jobs: + # https://github.com/actions/add-to-project + add-to-project: + 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 }} From b8f6ad8c9c0110931fb90f38529008e354fd1b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 6 Feb 2024 11:41:23 +0100 Subject: [PATCH 20/22] fix: remove pkg_resources for compatibility with python 3.12 pkg_resources is a package that is unavailable in python 3.12, unless setuptools is explicitely installed. Turns out, there are replacement functions coming from importlib_resources, which can be obtained from the importlib-resources pypi package. This package will be installed with tutor starting from 17.0.2. --- changelog.d/20240212_115536_regis_pkg_resources.md | 1 + tutordiscovery/plugin.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/20240212_115536_regis_pkg_resources.md 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/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index a889c12..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__ @@ -50,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, @@ -112,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( @@ -124,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"), "*", ) ): From 98e226c501bf3d50b262696c66cf9a93630cba00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 20 Feb 2024 15:15:40 +0100 Subject: [PATCH 21/22] ci: remove now useless OPENEDX_RELEASE variable --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5846bc7..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: quince GITHUB_REPO: overhangio/tutor-discovery include: From 9b1fdd977368b8450a2564b9cc50723d37717bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 5 Mar 2024 11:51:51 +0500 Subject: [PATCH 22/22] ci: don't even try to auto-add PRs to github project Auto-adding PRs to the Github project is not working because the github-token is not available there. --- .github/workflows/auto-add-to-project.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/auto-add-to-project.yml b/.github/workflows/auto-add-to-project.yml index d4ab7a4..ad870e2 100644 --- a/.github/workflows/auto-add-to-project.yml +++ b/.github/workflows/auto-add-to-project.yml @@ -1,16 +1,13 @@ name: Auto Add Issues and Pull Requests to Project on: - pull_request: - types: - - opened issues: types: - opened jobs: # https://github.com/actions/add-to-project - add-to-project: + add-to-proje name: Add issue and bugs to project runs-on: ubuntu-latest steps: