Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61c9b3e23c | ||
|
|
13da199f04 | ||
|
|
05ada48be5 | ||
|
|
fdd8651cb1 | ||
|
|
7348ff81d3 | ||
|
|
da8aa31723 | ||
|
|
c39f3acc4f | ||
|
|
72b2b10821 | ||
|
|
ef8a30fecd | ||
|
|
02a4b1efb1 |
5
.github/workflows/auto-add-to-project.yml
vendored
5
.github/workflows/auto-add-to-project.yml
vendored
@ -1,9 +1,12 @@
|
||||
name: Auto Add Issues to Project
|
||||
name: Auto Add Issues and Pull Requests to Project
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
# https://github.com/actions/add-to-project
|
||||
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -18,8 +18,6 @@ jobs:
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Upgrade pip
|
||||
run: python -m pip install --upgrade pip setuptools
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install .[dev]
|
||||
|
||||
21
.hatch_build.py
Normal file
21
.hatch_build.py
Normal 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
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@ -19,6 +19,21 @@ instructions, because git commits are used to generate release notes:
|
||||
|
||||
<!-- 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)
|
||||
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
recursive-include tutorxqueue/patches *
|
||||
recursive-include tutorxqueue/templates *
|
||||
24
Makefile
24
Makefile
@ -1,25 +1,30 @@
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: docs
|
||||
SRC_DIRS = ./tutorxqueue
|
||||
BLACK_OPTS = --exclude templates ${SRC_DIRS}
|
||||
|
||||
# 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
|
||||
black --check --diff $(BLACK_OPTS)
|
||||
ruff format --check --diff $(SRC_DIRS)
|
||||
|
||||
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.
|
||||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
||||
|
||||
format: ## Format code automatically
|
||||
black $(BLACK_OPTS)
|
||||
build-pythonpackage: ## Build the "tutor-xqueue" python package for upload to pypi
|
||||
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.
|
||||
isort --skip=templates ${SRC_DIRS}
|
||||
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
|
||||
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.
|
||||
scriv create
|
||||
@ -27,6 +32,9 @@ changelog-entry: ## Create a new changelog entry.
|
||||
changelog: ## Collect changelog entries in the CHANGELOG.md file.
|
||||
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 =
|
||||
help: ## Print this help
|
||||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
|
||||
|
||||
@ -19,7 +19,7 @@ You should then run the initialisation scripts. The easiest way to do this is to
|
||||
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>
|
||||
|
||||
@ -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)
|
||||
@ -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]
|
||||
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]
|
||||
|
||||
52
setup.py
52
setup.py
@ -1,52 +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="Edly",
|
||||
author_email="hello@edly.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.9",
|
||||
install_requires=["tutor>=19.0.0,<20.0.0", "requests"],
|
||||
extras_require={
|
||||
"dev": ["tutor[dev]>=19.0.0,<20.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.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
],
|
||||
)
|
||||
@ -1 +1 @@
|
||||
__version__ = "19.0.0"
|
||||
__version__ = "20.0.0"
|
||||
|
||||
@ -1 +1 @@
|
||||
setowner 1000 /mounts/xqueue
|
||||
setowner {{ APP_USER_ID }} /mounts/xqueue
|
||||
|
||||
@ -23,7 +23,7 @@ config: dict[str, dict[str, Any]] = {
|
||||
"defaults": {
|
||||
"VERSION": __version__,
|
||||
"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 }}",
|
||||
"MYSQL_DATABASE": "xqueue",
|
||||
"MYSQL_USERNAME": "xqueue",
|
||||
@ -200,7 +200,7 @@ class Client:
|
||||
message = response.get("content")
|
||||
if message != "Logged in":
|
||||
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]:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM docker.io/ubuntu:24.04
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
@ -21,7 +21,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
###### 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
|
||||
USER ${APP_USER_ID}
|
||||
|
||||
@ -34,18 +34,18 @@ 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==75.2.0 pip==24.2 wheel==0.44.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 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
|
||||
|
||||
EXPOSE 8000
|
||||
CMD uwsgi \
|
||||
--static-map /media=/openedx/data/media/ \
|
||||
--http 0.0.0.0:8000 \
|
||||
--thunder-lock \
|
||||
--single-interpreter \
|
||||
--enable-threads \
|
||||
--processes=2 \
|
||||
--wsgi-file xqueue/wsgi.py
|
||||
CMD ["uwsgi", \
|
||||
"--static-map", "/media=/openedx/data/media/", \
|
||||
"--http", "0.0.0.0:8000", \
|
||||
"--thunder-lock", \
|
||||
"--single-interpreter", \
|
||||
"--enable-threads", \
|
||||
"--processes=2", \
|
||||
"--wsgi-file", "xqueue/wsgi.py"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user