From 5db7addac8869b8d03b0aced5615bcd5f298664d Mon Sep 17 00:00:00 2001 From: Jhony Avella Date: Fri, 3 May 2024 09:00:16 -0500 Subject: [PATCH 1/2] feat: adding Python 3.12 support for Xqueue (#30) --- .github/workflows/test.yml | 11 ++++++---- tutorxqueue/plugin.py | 16 ++++++-------- .../templates/xqueue/build/xqueue/Dockerfile | 22 ++++++++++--------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 829f613..428a7b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,12 +7,15 @@ on: jobs: tests: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.12'] steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Upgrade pip run: python -m pip install --upgrade pip setuptools - name: Install dependencies diff --git a/tutorxqueue/plugin.py b/tutorxqueue/plugin.py index 25ac8e3..a237460 100644 --- a/tutorxqueue/plugin.py +++ b/tutorxqueue/plugin.py @@ -146,21 +146,19 @@ def grade_submission( print_result( context, "grade_submission", - ( - submission_id, - submission_key, - grade, - correct, - message, - ), + submission_id, + submission_key, + grade, + correct, + message, ) def print_result( context: click.Context, client_func_name: str, - *args: tuple[Any, ...], - **kwargs: dict[str, Any], + *args: Any, + **kwargs: Any, ) -> None: user_config = tutor_config.load(context.root) # type: ignore client = Client(user_config, url=context.url) # type: ignore diff --git a/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile b/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile index 205f68b..9a82336 100644 --- a/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile +++ b/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1.4 ###### Minimal image with base system requirements for most stages ###### -FROM docker.io/ubuntu:20.04 as minimal +FROM docker.io/python:3.12-slim-bookworm ARG DEBIAN_FRONTEND=noninteractive RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ @@ -8,19 +8,21 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt update && \ apt upgrade -y && \ apt install -y \ - language-pack-en \ + locales \ git \ - python3 \ - python3-pip \ - python3-venv \ - libmysqlclient-dev \ - pkg-config -RUN ln -s /usr/bin/python3 /usr/bin/python + python3-dev \ + build-essential \ + default-libmysqlclient-dev \ + pkg-config && \ + sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ + locale-gen +ENV LC_ALL en_US.UTF-8 ###### Git-clone xqueue repo ###### ARG APP_USER_ID=1000 RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app USER ${APP_USER_ID} + RUN git clone {{ XQUEUE_REPOSITORY }} --branch {{ XQUEUE_REPOSITORY_VERSION }} --depth 1 /openedx/xqueue WORKDIR /openedx/xqueue @@ -30,9 +32,9 @@ ENV PATH /openedx/venv/bin:${PATH} # https://pypi.org/project/setuptools/ # https://pypi.org/project/pip/ # https://pypi.org/project/wheel/ -RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install setuptools==68.2.2 pip==23.2.1. wheel==0.41.2 +RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install setuptools==69.2.0 pip==24.0 wheel==0.43.0 RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements.txt -RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install uwsgi==2.0.22 +RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install uwsgi==2.0.25.1 RUN mkdir /openedx/data /openedx/data/media From a880f44b9f81de40e58102cc53569a3e5b06007c Mon Sep 17 00:00:00 2001 From: jfavellar90 Date: Thu, 9 May 2024 19:37:27 -0500 Subject: [PATCH 2/2] feat: upgrade to redwood --- CHANGELOG.md | 8 ++++++++ changelog.d/20240212_115536_regis_pkg_resources.md | 1 - setup.py | 4 ++-- tutorxqueue/__about__.py | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) delete mode 100644 changelog.d/20240212_115536_regis_pkg_resources.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f024f..8ded908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,14 @@ instructions, because git commits are used to generate release notes: + +## v18.0.0 (2024-05-09) + +- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb) + +- 💥[Feature] Upgrade Python version to 3.12.3. (by @jfavellar90) +- 💥[Feature] Upgrade to Redwood. (by @jfavellar90) + ## v17.0.0 (2023-12-09) diff --git a/changelog.d/20240212_115536_regis_pkg_resources.md b/changelog.d/20240212_115536_regis_pkg_resources.md deleted file mode 100644 index 35b6d20..0000000 --- a/changelog.d/20240212_115536_regis_pkg_resources.md +++ /dev/null @@ -1 +0,0 @@ -- [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 1d1832f..4e40240 100644 --- a/setup.py +++ b/setup.py @@ -33,9 +33,9 @@ packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.8", - install_requires=["tutor>=17.0.0,<18.0.0", "requests"], + install_requires=["tutor>=18.0.0,<19.0.0", "requests"], extras_require={ - "dev": ["tutor[dev]>=17.0.0,<18.0.0"], + "dev": ["tutor[dev]>=18.0.0,<19.0.0"], }, entry_points={"tutor.plugin.v1": ["xqueue = tutorxqueue.plugin"]}, classifiers=[ diff --git a/tutorxqueue/__about__.py b/tutorxqueue/__about__.py index a08b09c..c6a8b8e 100644 --- a/tutorxqueue/__about__.py +++ b/tutorxqueue/__about__.py @@ -1 +1 @@ -__version__ = "17.0.0" +__version__ = "18.0.0"