Compare commits

...

22 Commits

Author SHA1 Message Date
Florian du Garage Num
61c9b3e23c remove hard-coded uid 1000
Some checks failed
Run tests / tests (3.12) (push) Has been cancelled
Run tests / tests (3.9) (push) Has been cancelled
Sync with private repo / sync (push) Has been cancelled
2025-09-30 21:48:26 +02:00
Abdul Rehman
13da199f04
feat: migrate from pylint/black to ruff (#42) 2025-09-03 21:53:45 +05:00
Ahmed Khalid
05ada48be5
Merge pull request #41 from overhangio/teak 2025-06-27 17:08:45 +05:00
Syed Muhammad Dawoud Sheraz Ali
fdd8651cb1 chore: generate changelog for v20 2025-06-05 17:45:37 +05:00
jfavellar90
7348ff81d3 feat: upgrade to teak 2025-04-04 14:10:01 -05:00
Syed Muhammad Dawoud Sheraz Ali
da8aa31723
v19.0.2 (#40) 2025-03-12 15:35:10 +05:00
Syed Muhammad Dawoud Sheraz Ali
c39f3acc4f
build: Add hatch_build in sdist to fix installation issues (#39)
* build: Add hatch_build in sdist to fix installation issues
2025-03-12 15:25:29 +05:00
jfavellar90
72b2b10821 v19.0.1 2025-03-11 13:22:39 -05:00
Jhony Avella
ef8a30fecd
feat: migrate from setup.py to pyproject.toml (#38)
* feat: migrate from setup.py to pyproject.toml

* chore: addressing PR comments

* chore: addressing more comments
2025-03-11 13:21:02 -05:00
Syed Muhammad Dawoud Sheraz Ali
02a4b1efb1
build: re-add auto-add for PRs with a different target (#37) 2025-01-17 11:31:23 +05:00
Régis Behmo
7de36adacd
feat: upgrade to sumac
---------

Co-authored-by: Régis Behmo <regis@behmo.com>
Co-authored-by: Overhang.IO <ci@overhang.io>
Co-authored-by: Syed Muhammad Dawoud Sheraz Ali <dawoud.sheraz@gmail.com>
2024-12-16 21:58:55 +01:00
Syed Muhammad Dawoud Sheraz Ali
93ad17bb71 chore: update changelog 2024-12-09 18:46:47 +05:00
jfavellar90
8ce407cc40 feat: upgrade to sumac 2024-11-29 22:26:07 +05:00
Régis Behmo
eb47275595 Merge branch 'release' 2024-11-27 18:35:01 +01:00
Syed Muhammad Dawoud Sheraz Ali
a42b22d9ea feat!: Rename branches master->release, nightly->main 2024-11-27 18:34:08 +01:00
Overhang.IO
4136fc6620 Merge remote-tracking branch 'origin/master' into nightly 2024-11-14 16:27:07 +00:00
Syed Muhammad Dawoud Sheraz Ali
a73f745707
chore: remove python 3.8 references and set py39 as minimum version (#35) 2024-11-14 21:19:31 +05:00
Jhony Avella
86abc64404
Ubuntu 24.04 Upgrade (#33)
* chore: xqueue service now uses ubuntu 24.04 as base image

* chore: using 1000 UID. Updating setuptools

* chore: adding changelog entry
2024-10-22 16:08:39 -05:00
Régis Behmo
9f891b2f93 docs: *.local.edly.io -> *.local.openedx.io
The default URL to run a local platform switched from local.edly.io to
local.openedx.io. This changes makes it clearer for everyone that Tutor
is to run Open edX.

See: https://github.com/overhangio/tutor/issues/1120
2024-10-17 08:36:40 +02:00
Régis Behmo
9f6b2ffdcd ci: upgrade vendor actions 2024-10-03 11:16:24 +02:00
Régis Behmo
d478f4de4f docs: fix author domain name 2024-10-01 09:08:48 +02:00
Régis Behmo
f0ac92b85b fix: docker build deprecation warnings
With the latest Docker upgrade, we got the following warnings during
build:

	FromAsCasing: 'as' and 'FROM' keywords' casing do not match
	LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format
2024-06-21 17:12:57 +02:00
15 changed files with 199 additions and 105 deletions

View File

@ -1,9 +1,12 @@
name: Auto Add Issues to Project name: Auto Add Issues and Pull Requests to Project
on: on:
issues: issues:
types: types:
- opened - opened
pull_request_target:
types:
- opened
jobs: jobs:
# https://github.com/actions/add-to-project # https://github.com/actions/add-to-project
@ -11,7 +14,7 @@ jobs:
name: Add issue and bugs to project name: Add issue and bugs to project
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/add-to-project@v0.5.0 - uses: actions/add-to-project@v1.0.2
with: with:
project-url: https://github.com/orgs/overhangio/projects/4 project-url: https://github.com/orgs/overhangio/projects/4
github-token: ${{ secrets.GH_PROJECT_PERSONAL_ACCESS_TOKEN }} github-token: ${{ secrets.GH_PROJECT_PERSONAL_ACCESS_TOKEN }}

View File

@ -2,13 +2,13 @@ name: Sync with private repo
on: on:
push: push:
branches: [ master, main, nightly ] branches: [ release, main ]
jobs: jobs:
sync: sync:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Add remote - name: Add remote

View File

@ -2,22 +2,22 @@ name: Run tests
on: on:
pull_request: pull_request:
branches: [master] branches: [ release, main ]
push:
branches: [ release, main ]
jobs: jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ['3.8', '3.12'] python-version: ['3.9', '3.12']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies - name: Install dependencies
run: | run: |
pip install .[dev] pip install .[dev]

21
.hatch_build.py Normal file
View File

@ -0,0 +1,21 @@
# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
import os
import typing as t
from hatchling.metadata.plugin.interface import MetadataHookInterface
HERE = os.path.dirname(__file__)
class MetaDataHook(MetadataHookInterface):
def update(self, metadata: dict[str, t.Any]) -> None:
about = load_about()
metadata["version"] = about["__version__"]
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(os.path.join(HERE, "tutorxqueue", "__about__.py"), "rt", encoding="utf-8") as f:
exec(f.read(), about)
return about

View File

@ -19,6 +19,36 @@ instructions, because git commits are used to generate release notes:
<!-- scriv-insert-here --> <!-- scriv-insert-here -->
<a id='changelog-20.0.0'></a>
## v20.0.0 (2025-06-05)
- 💥[Feature] Upgrade to Teak. (by @jfavellar90)
<a id='changelog-19.0.2'></a>
## v19.0.2 (2025-03-12)
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
<a id='changelog-19.0.1'></a>
## v19.0.1 (2025-03-11)
- [Improvement] Migrate from `setup.py` (setuptools) to `pyproject.toml` (hatch). (by @jfavellar90)
<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-10-24)
- 💥 [Deprecation] Drop support for python 3.8 and set Python 3.9 as the minimum supported python version. (by @DawoudSheraz)
- 💥[Improvement] Rename Tutor's two branches (by @DawoudSheraz):
* Rename **master** to **release**, as this branch runs the latest official Open edX release tag.
* Rename **nightly** to **main**, as this branch runs the Open edX master branches, which are the basis for the next Open edX release.
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)
- 💥[Feature] Update Xqueue Image to use Ubuntu 24.04 as base OS. (by @jfavellar90)
- 💥[Feature] Upgrade to Sumac. (by @jfavellar90)
<a id='changelog-18.0.0'></a> <a id='changelog-18.0.0'></a>
## v18.0.0 (2024-05-09) ## v18.0.0 (2024-05-09)

View File

@ -1,2 +0,0 @@
recursive-include tutorxqueue/patches *
recursive-include tutorxqueue/templates *

View File

@ -1,25 +1,30 @@
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
.PHONY: docs .PHONY: docs
SRC_DIRS = ./tutorxqueue SRC_DIRS = ./tutorxqueue
BLACK_OPTS = --exclude templates ${SRC_DIRS}
# Warning: These checks are not necessarily run on every PR. # Warning: These checks are not necessarily run on every PR.
test: test-lint test-types test-format # Run some static checks. test: test-lint test-format test-types test-pythonpackage # Run some static checks.
test-format: ## Run code formatting tests test-format: ## Run code formatting tests
black --check --diff $(BLACK_OPTS) ruff format --check --diff $(SRC_DIRS)
test-lint: ## Run code linting tests test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS} ruff check ${SRC_DIRS}
test-types: ## Run type checks. test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS} mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
format: ## Format code automatically build-pythonpackage: ## Build the "tutor-xqueue" python package for upload to pypi
black $(BLACK_OPTS) python -m build --sdist
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
isort --skip=templates ${SRC_DIRS} twine check dist/tutor_xqueue-$(shell make version).tar.gz
format: ## Format code automatically
ruff format ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry. changelog-entry: ## Create a new changelog entry.
scriv create scriv create
@ -27,6 +32,9 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file. changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect scriv collect
version: ## Print the current tutor-xqueue version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorxqueue", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE =  ESCAPE = 
help: ## Print this help help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ @grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -19,7 +19,7 @@ You should then run the initialisation scripts. The easiest way to do this is to
Usage Usage
----- -----
In the Open edX studio, edit a course and add a new "Advanced blank problem" ("Problem" → "Advanced" → "Blank Advanced Problem"). Then, click "Edit" and copy-paste the following in the editor:: In the Open edX studio, edit a course and add a new "Advanced blank problem" ("Problem" → "Advanced problem types" → "Blank problem"). Then, copy-paste the following in the Blank problem editor::
<problem> <problem>
@ -56,7 +56,7 @@ For a problem that includes a file submission, write instead::
Note that in all cases, the queue name must be "openedx". Note that in all cases, the queue name must be "openedx".
Save and publish the created unit. Then, access the unit from the LMS and attempt to answer the problem. The answer is sent to the Xqueue service. If you know how to use the Xqueue API, you can access it at http(s)://xqueue.LMS_HOST (in production) or http://xqueue.local.edly.io (in development). However, the Xqueue API is a bit awkward to use. Tutor provides a simple command-line interface to interact with the Xqueue service. Save and publish the created unit. Then, access the unit from the LMS and attempt to answer the problem. The answer is sent to the Xqueue service. If you know how to use the Xqueue API, you can access it at http(s)://xqueue.LMS_HOST (in production) or http://xqueue.local.openedx.io (in development). However, the Xqueue API is a bit awkward to use. Tutor provides a simple command-line interface to interact with the Xqueue service.
Count the number of submissions that need to be graded:: Count the number of submissions that need to be graded::
@ -96,7 +96,7 @@ Grade the submission (in this case, mark it as being correct)::
The submission should then appear as correct with the message that you provided on the command line: The submission should then appear as correct with the message that you provided on the command line:
.. image:: https://github.com/overhangio/tutor-xqueue/raw/master/screenshots/correctanswer.png .. image:: https://github.com/overhangio/tutor-xqueue/raw/release/screenshots/correctanswer.png
:alt: Correct answer :alt: Correct answer
:align: center :align: center
@ -128,7 +128,7 @@ Feel free to add breakpoints (``breakpoint()``) anywhere in your source code to
License License
------- -------
This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-xqueue/blob/master/LICENSE.txt>`_. This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-xqueue/blob/release/LICENSE.txt>`_.
Troubleshooting Troubleshooting
--------------- ---------------

View File

@ -0,0 +1,2 @@
- [Improvement] Migrate from pylint and black to ruff. (by @rehmansheikh222)
- [Improvement] Test python package distribution build when running make test. (by @rehmansheikh222)

View File

@ -1,2 +1,85 @@
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
# https://hatch.pypa.io/latest/config/build/
[project]
name = "tutor-xqueue"
description = "A Tutor plugin for Xqueue (external grading system)"
authors = [
{ name = "Edly" },
{ email = "hello@edly.io"},
]
maintainers = [
{ name = "Jhony Avella" },
{ email = "jhony.avella@edunext.co" },
]
license = {text = "AGPL-3.0-only"}
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.9"
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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tutor>=20.0.0,<21.0.0",
]
# These fields will be set by hatch_build.py
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=20.0.0,<21.0.0",
"ruff"
]
# https://packaging.python.org/en/latest/specifications/well-known-project-urls/#well-known-labels
[project.urls]
Homepage = "https://docs.tutor.edly.io/"
Documentation = "https://github.com/overhangio/tutor-xqueue#readme"
Issues = "https://github.com/overhangio/tutor-xqueue/issues"
Source = "https://github.com/overhangio/tutor-xqueue"
Changelog = "https://github.com/overhangio/tutor-xqueue/blob/release/CHANGELOG.md"
Community = "https://discuss.openedx.org/tag/tutor"
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["hatchling"]
build-backend = "hatchling.build"
# hatch-specific configuration
[tool.hatch.metadata.hooks.custom]
path = ".hatch_build.py"
[tool.hatch.build.targets.wheel]
packages = ["tutorxqueue"]
[tool.hatch.build.targets.sdist]
# Disable strict naming, otherwise twine is not able to detect name/version
strict-naming = false
include = [ "/tutorxqueue", ".hatch_build.py"]
exclude = ["tests*"]
[project.entry-points."tutor.plugin.v1"]
xqueue = "tutorxqueue.plugin"
[tool.ruff]
exclude = ["templates", "docs/_ext"]
[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]
# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]
[tool.ruff.format]

View File

@ -1,53 +0,0 @@
import io
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f:
readme = f.read()
about = {}
with io.open(
os.path.join(here, "tutorxqueue", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about)
setup(
name="tutor-xqueue",
version=about["__version__"],
url="https://docs.tutor.edly.io/",
project_urls={
"Documentation": "https://docs.tutor.edly.io/",
"Code": "https://github.com/overhangio/tutor-xqueue",
"Issue tracker": "https://github.com/overhangio/tutor-xqueue/issues",
"Community": "https://discuss.openedx.org",
},
license="AGPLv3",
author="Overhang.IO",
author_email="contact@overhang.io",
maintainer="eduNEXT",
description="A Tutor plugin for Xqueue (external grading system)",
long_description=readme,
long_description_content_type="text/x-rst",
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.8",
install_requires=["tutor>=18.0.0,<19.0.0", "requests"],
extras_require={
"dev": ["tutor[dev]>=18.0.0,<19.0.0"],
},
entry_points={"tutor.plugin.v1": ["xqueue = tutorxqueue.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.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)

View File

@ -1 +1 @@
__version__ = "18.0.0" __version__ = "20.0.0"

View File

@ -1 +1 @@
setowner 1000 /mounts/xqueue setowner {{ APP_USER_ID }} /mounts/xqueue

View File

@ -15,7 +15,7 @@ from tutor.__about__ import __version_suffix__
from .__about__ import __version__ from .__about__ import __version__
# Handle version suffix in nightly mode, just like tutor core # Handle version suffix in main mode, just like tutor core
if __version_suffix__: if __version_suffix__:
__version__ += "-" + __version_suffix__ __version__ += "-" + __version_suffix__
@ -23,7 +23,7 @@ config: dict[str, dict[str, Any]] = {
"defaults": { "defaults": {
"VERSION": __version__, "VERSION": __version__,
"AUTH_USERNAME": "lms", "AUTH_USERNAME": "lms",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-xqueue:{{ XQUEUE_VERSION }}", "DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-xqueue:{{ XQUEUE_VERSION }}", # noqa: E501
"HOST": "xqueue.{{ LMS_HOST }}", "HOST": "xqueue.{{ LMS_HOST }}",
"MYSQL_DATABASE": "xqueue", "MYSQL_DATABASE": "xqueue",
"MYSQL_USERNAME": "xqueue", "MYSQL_USERNAME": "xqueue",
@ -200,7 +200,7 @@ class Client:
message = response.get("content") message = response.get("content")
if message != "Logged in": if message != "Logged in":
raise exceptions.TutorError( raise exceptions.TutorError(
f"Could not login to xqueue server at {self.base_url}. Response: '{message}'" f"Could not login to xqueue server at {self.base_url}. Response: '{message}'" # noqa: E501
) )
def show_submission(self, queue: str) -> Union[dict[str, Any], Any]: def show_submission(self, queue: str) -> Union[dict[str, Any], Any]:

View File

@ -1,25 +1,27 @@
# syntax=docker/dockerfile:1.4 # syntax=docker/dockerfile:1
###### Minimal image with base system requirements for most stages ###### FROM docker.io/ubuntu:24.04
FROM docker.io/python:3.12-slim-bookworm
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
# Delete default UID=1000 `ubuntu` user to ensure we can use id 1000 for app user
RUN userdel -r ubuntu
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \ apt update && \
apt upgrade -y && \ apt upgrade -y && \
apt install -y \ apt install -y \
locales \ language-pack-en \
git \ git \
python3-dev \ python3 \
build-essential \ python3-pip \
default-libmysqlclient-dev \ python3-venv \
pkg-config && \ libmysqlclient-dev \
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ pkg-config
locale-gen RUN ln -s /usr/bin/python3 /usr/bin/python
ENV LC_ALL en_US.UTF-8
###### Git-clone xqueue repo ###### ###### Git-clone xqueue repo ######
ARG APP_USER_ID=1000 ARG APP_USER_ID={{ HOST_USER_ID }}
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
USER ${APP_USER_ID} USER ${APP_USER_ID}
@ -28,22 +30,22 @@ WORKDIR /openedx/xqueue
###### Install python venv ###### ###### Install python venv ######
RUN python -m venv /openedx/venv RUN python -m venv /openedx/venv
ENV PATH /openedx/venv/bin:${PATH} ENV PATH=/openedx/venv/bin:${PATH}
# https://pypi.org/project/setuptools/ # https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/ # https://pypi.org/project/pip/
# https://pypi.org/project/wheel/ # https://pypi.org/project/wheel/
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 setuptools==78.1.0 pip==25.0.1 wheel==0.46.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 -r requirements.txt
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install uwsgi==2.0.25.1 RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install uwsgi==2.0.28
RUN mkdir /openedx/data /openedx/data/media RUN mkdir /openedx/data /openedx/data/media
EXPOSE 8000 EXPOSE 8000
CMD uwsgi \ CMD ["uwsgi", \
--static-map /media=/openedx/data/media/ \ "--static-map", "/media=/openedx/data/media/", \
--http 0.0.0.0:8000 \ "--http", "0.0.0.0:8000", \
--thunder-lock \ "--thunder-lock", \
--single-interpreter \ "--single-interpreter", \
--enable-threads \ "--enable-threads", \
--processes=2 \ "--processes=2", \
--wsgi-file xqueue/wsgi.py "--wsgi-file", "xqueue/wsgi.py"]