Repository navigation
feat: add Python 3.11 and Django 4.2 support - #27
Conversation
abhalsod-sonata
left a comment
There was a problem hiding this comment.
Looks good, and thanks for following up on 2.0.0 so the LMS can actually install this. CI is green on 3.11/3.12 × Django 4.2/5.2 plus quality and pii_check, and the matrix include entries correctly add quality and pii_check as separate 3.12 jobs.
The django-constraints.txt approach is the right call for this repo. base.in lists djangorestframework, django-filter, django-simple-history and edx-opaque-keys directly, so per-package caps in constraints.txt (what ai-aside and federated-content-connector did) would be copied into install_requires by load_requirements. Pinning Django<5.0 in a nested file and compiling on Python 3.11 gives 3.11/4.2-compatible pins with no caps in the published metadata.
A few small things:
1. Guard make upgrade to Python 3.11 (optional, Makefile, outside this diff). The pins only stay 3.11-compatible because they're compiled on 3.11. If someone runs make upgrade on 3.12, the 3.12-only releases come straight back (code-annotations 3.0.0, openedx-events 11.x, edx-opaque-keys 4.0.1, edx-ccx-keys 2.1.0), and only the py311 CI legs would catch it. A one-line check at the top of the upgrade target makes it fail fast:
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
@python -c "import sys; sys.exit(0 if sys.version_info[:2] == (3, 11) else 'make upgrade must run on Python 3.11, the oldest supported version (see requirements/constraints.txt).')"
pip install -qr requirements/pip-tools.txtChecked locally: it stops with that message on 3.12 and continues on 3.11.
2. Rollout of the edx-internal pin bump. From the LMS's current 1.3.4 to 2.1.0, the only runtime changes are the removed default_app_config (already ignored on Django 4.2) and migration 0006. 0006 adds an index on history_date in learner_pathway_progress_historicallearnerpathwayprogress, so it's worth checking that table's size before the LMS bump. edx-internal's check_private_dependencies.yml runs on 3.11, so it will confirm the install. For context, the old <1.3.5 cap only meant "latest 1.3.x" when it was added (2023-07-21); it isn't a known-bug pin.
3. Security (no action in this PR). pip-audit on the new pins flags Django 4.2.30 (CVE-2026-15307, fixed only in 5.2.17/6.0.8 because 4.2 is out of support) and social-auth-app-django/social-auth-core (pulled in by edx-enterprise). These are dev/test pins only, since the LMS installs its own versions, and the Django advisory only affects GeoDjango, which neither this plugin nor the LMS uses. It's one more reason for the edxapp move to Django 5.2 (LP-1304).
LP-1282: Add Python 3.11 and Django 4.2 support
Why: edxapp (LMS) runs Python 3.11 with Django 4.2. Version 2.0.0 requires Python 3.12, so the LMS can't install it. This release makes the package work in edxapp.
What changed
python_requires>=3.11, classifiers updated).py{311,312}-django{42,52}, plus quality, docs and pii_check.Django<5.0pin is in a separaterequirements/django-constraints.txt. If it were inconstraints.txt,setup.pywould copy it intoinstall_requiresand the package would block Django 5.2.Testing:
toxpasses in all 7 envs (24 tests in each Python/Django combination). The built package showsRequires-Python: >=3.11andRequires-Dist: Djangowith no cap.makemigrations --checkreports no changes on Django 4.2 and 5.2.Next: after release, bump the
learner-pathway-progress<1.3.5pin in edx-internal to2.1.0.