feat: upgrade to nutmeg

This commit is contained in:
Régis Behmo 2022-05-10 12:18:20 +02:00 committed by Régis Behmo
parent 5f24df5177
commit 47c90a8409
11 changed files with 79 additions and 27 deletions

View File

@ -2,7 +2,7 @@ variables:
TUTOR_PLUGIN: notes
TUTOR_IMAGES: notes
TUTOR_PYPI_PACKAGE: tutor-notes
OPENEDX_RELEASE: maple
OPENEDX_RELEASE: nutmeg
GITHUB_REPO: overhangio/tutor-notes
include:

View File

@ -1,9 +1,9 @@
Students notes plugin for `Tutor <https://docs.tutor.overhang.io>`_
===================================================================
This is a plugin for `Tutor <https://docs.tutor.overhang.io>`_ to easily add the `Open edX note-taking app <https://github.com/edx/edx-notes-api>`_ to an Open edX platform. This app allows students to annotate portions of the courseware (see `the official documentation <https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-maple.master/exercises_tools/notes.html>`_).
This is a plugin for `Tutor <https://docs.tutor.overhang.io>`_ to easily add the `Open edX note-taking app <https://github.com/edx/edx-notes-api>`_ to an Open edX platform. This app allows students to annotate portions of the courseware (see `the official documentation <https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-nutmeg.master/exercises_tools/notes.html>`_).
.. image:: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-maple.master/_images/SFD_SN_bodyexample.png
.. image:: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-nutmeg.master/_images/SFD_SN_bodyexample.png
:alt: Notes in action
Installation

View File

@ -30,16 +30,15 @@ setup(
long_description=readme,
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.5",
install_requires=["tutor>=13.0.0,<14.0.0"],
entry_points={"tutor.plugin.v0": ["notes = tutornotes.plugin"]},
python_requires=">=3.7",
install_requires=["tutor>=14.0.0,<15.0.0"],
entry_points={"tutor.plugin.v1": ["notes = tutornotes.plugin"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",

View File

@ -1 +1 @@
__version__ = "13.0.1"
__version__ = "14.0.0"

View File

@ -1 +0,0 @@
"ENABLE_EDXNOTES": true

View File

@ -0,0 +1,2 @@
# Student notes
FEATURES["ENABLE_EDXNOTES"] = True

View File

@ -3,11 +3,13 @@ import os
import pkg_resources
from tutor import hooks as tutor_hooks
from .__about__ import __version__
config = {
"add": {
"unique": {
"MYSQL_PASSWORD": "{{ 8|random_string }}",
"SECRET_KEY": "{{ 24|random_string }}",
"OAUTH2_SECRET": "{{ 24|random_string }}",
@ -21,21 +23,68 @@ config = {
},
}
templates = pkg_resources.resource_filename("tutornotes", "templates")
hooks = {
"init": ["mysql", "lms", "notes"],
"build-image": {"notes": "{{ NOTES_DOCKER_IMAGE }}"},
"remote-image": {"notes": "{{ NOTES_DOCKER_IMAGE }}"},
}
# Initialization hooks
tutor_hooks.Filters.COMMANDS_INIT.add_item((
"mysql",
("notes", "tasks", "mysql", "init"),
))
tutor_hooks.Filters.COMMANDS_INIT.add_item((
"lms",
("notes", "tasks", "lms", "init"),
))
tutor_hooks.Filters.COMMANDS_INIT.add_item((
"notes",
("notes", "tasks", "notes", "init"),
))
# Image management
tutor_hooks.Filters.IMAGES_BUILD.add_item((
"notes",
("plugins", "notes", "build", "notes"),
"{{ NOTES_DOCKER_IMAGE }}",
(),
))
tutor_hooks.Filters.IMAGES_PULL.add_item((
"notes",
"{{ NOTES_DOCKER_IMAGE }}",
))
tutor_hooks.Filters.IMAGES_PUSH.add_item((
"notes",
"{{ NOTES_DOCKER_IMAGE }}",
))
def patches():
all_patches = {}
for path in glob(
os.path.join(pkg_resources.resource_filename("tutornotes", "patches"), "*")
):
with open(path) as patch_file:
name = os.path.basename(path)
content = patch_file.read()
all_patches[name] = content
return all_patches
####### Boilerplate code
# Add the "templates" folder as a template root
tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
pkg_resources.resource_filename("tutornotes", "templates")
)
# Render the "build" and "apps" folders
tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
[
("notes/build", "plugins"),
("notes/apps", "plugins"),
],
)
# Load patches from files
for path in glob(
os.path.join(
pkg_resources.resource_filename("tutornotes", "patches"),
"*",
)
):
with open(path, encoding="utf-8") as patch_file:
tutor_hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))
# Add configuration entries
tutor_hooks.Filters.CONFIG_DEFAULTS.add_items(
[
(f"NOTES_{key}", value)
for key, value in config.get("defaults", {}).items()
]
)
tutor_hooks.Filters.CONFIG_UNIQUE.add_items(
[
(f"NOTES_{key}", value)
for key, value in config.get("unique", {}).items()
]
)
tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(list(config.get("overrides", {}).items()))

View File

@ -16,7 +16,10 @@ WORKDIR /app/edx-notes-api
RUN python -m venv /app/venv
ENV PATH /app/venv/bin:${PATH}
RUN pip install setuptools==44.1.0 pip==20.3.4 wheel==0.37.0
# 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 pip3 install -r requirements/base.txt
EXPOSE 8000