From 243bc9c00c9f2f647ba2d0ac541c2a35b0027fee Mon Sep 17 00:00:00 2001 From: edX requirements bot Date: Fri, 23 Feb 2024 07:37:40 -0500 Subject: [PATCH 1/2] feat: Adding python3.11 support. --- .github/workflows/ci.yml | 10 ++++------ setup.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b442cc..3c7f4fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,10 @@ name: Python CI on: push: branches: - - master + - master pull_request: branches: - - '**' + - '**' jobs: run_tests: @@ -15,10 +15,8 @@ jobs: strategy: matrix: os: - - ubuntu-20.04 - python-version: - - 3.8 - + - ubuntu-20.04 + python-version: ['3.8', '3.11'] steps: - uses: actions/checkout@v2 - name: setup python diff --git a/setup.py b/setup.py index cf56982..0129be5 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='xqueue_watcher', - version='0.2', + version='0.3', description='XQueue Pull Grader', packages=[ 'grader_support', From dc932887bb0c6a36d54ee2a44de7988fd09acc45 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Fri, 29 Mar 2024 11:45:48 -0400 Subject: [PATCH 2/2] fix: Switch from imp to importlib. The import in `grader.py` was just not being used so I dropped it. In jailedgrader.py I replaced the implementation with the sourcefile loader from importlib which is still around. The `imp` module is deprecated and was removed in Python 3.12 With these changes the code is compatible with Python 3.8 and 3.12. --- .github/workflows/ci.yml | 2 +- xqueue_watcher/grader.py | 1 - xqueue_watcher/jailedgrader.py | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c7f4fe..30f715e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: matrix: os: - ubuntu-20.04 - python-version: ['3.8', '3.11'] + python-version: ['3.8', '3.11', '3.12'] steps: - uses: actions/checkout@v2 - name: setup python diff --git a/xqueue_watcher/grader.py b/xqueue_watcher/grader.py index da6ad86..7708e58 100644 --- a/xqueue_watcher/grader.py +++ b/xqueue_watcher/grader.py @@ -2,7 +2,6 @@ Implementation of a grader compatible with XServer """ import html -import imp import sys import time import json diff --git a/xqueue_watcher/jailedgrader.py b/xqueue_watcher/jailedgrader.py index b9c4f45..f3f1c7d 100644 --- a/xqueue_watcher/jailedgrader.py +++ b/xqueue_watcher/jailedgrader.py @@ -4,7 +4,7 @@ import codecs import os import sys -import imp +import importlib import json import random import gettext @@ -122,7 +122,8 @@ def grade(self, grader_path, grader_config, submission): # Import the grader, straight from the original file. (It probably isn't in # sys.path, and we may be in a long running gunicorn process, so we don't # want to add stuff to sys.path either.) - grader_module = imp.load_source("grader_module", str(grader_path)) + sf_loader = importlib.machinery.SourceFileLoader("grader_module", str(grader_path)) + grader_module = sf_loader.load_module() grader = grader_module.grader # Preprocess for grader-specified errors