Repository: wagtail/wagtail-ai (language: python)

Issue:
Bump minimum Wagtail/Django/Python versions
Once #11 is complete, we will be relying on APIs only present in Wagtail 5.1+.

To avoid having to keep Draftail hacks in the codebase and so we have a 'modern' set of dependencies on which to build the future of the package; I propose we bump the minimum supported versions to:

- Wagtail 5.2 (LTS)
- Django 4.2 (LTS)
- Python 3.11


Discussion / hints:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 50b07d6..e04182d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,14 +21,12 @@ repos:
       - id: end-of-file-fixer
       - id: trailing-whitespace
   - repo: https://github.com/psf/black-pre-commit-mirror
-    rev: 23.9.1
+    rev: 23.11.0
     hooks:
       - id: black
-        language_version: python3
-        args: ['--target-version', 'py37']
   - repo: https://github.com/astral-sh/ruff-pre-commit
     # Ruff version.
-    rev: v0.0.291
+    rev: v0.1.6
     hooks:
       - id: ruff
         args: [--fix, --exit-non-zero-on-fix]
diff --git a/README.md b/README.md
index 7476134..ecd4852 100644
--- a/README.md
+++ b/README.md
@@ -110,7 +110,7 @@ Now you can run tests as shown below:
 tox
 ```
 
-or, you can run them for a specific environment `tox -e python3.8-django3.2-wagtail2.15` or specific test
-`tox -e python3.9-django3.2-wagtail2.15-sqlite wagtail-ai.tests.test_file.TestClass.test_method`
+or, you can run them for a specific environment `tox -e python3.11-django4.2-wagtail5.2` or specific test
+`tox -e python3.11-django4.2-wagtail5.2-sqlite wagtail-ai.tests.test_file.TestClass.test_method`
 
 To run the test app interactively, use `tox -e interactive`, visit `http://127.0.0.1:8020/admin/` and log in with `admin`/`changeme`.
diff --git a/pyproject.toml b/pyproject.toml
index 027f072..fa9fae8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -15,30 +15,24 @@ classifiers = [
     "Operating System :: OS Independent",
     "Programming Language :: Python",
     "Programming Language :: Python :: 3",
-    "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",
     "Framework :: Django",
-    "Framework :: Django :: 3.0",
-    "Framework :: Django :: 3.1",
-    "Framework :: Django :: 3.2",
-    "Framework :: Django :: 4.0",
-    "Framework :: Django :: 4.1",
     "Framework :: Django :: 4.2",
     "Framework :: Django :: 5.0",
     "Framework :: Wagtail",
-    "Framework :: Wagtail :: 4",
     "Framework :: Wagtail :: 5",
 ]
 dynamic = ["version"]
 dependencies = [
-    "Django>=3.2",
-    "Wagtail>=4.0",
+    "Django>=4.2",
+    "Wagtail>=5.2",
     "langchain>=0.0.106",
     "tiktoken>=0.3.3",
     "every-ai>=1.1.1"
 ]
+requires-python = ">=3.11"
+
 [project.optional-dependencies]
 openai = [
     "every-ai[openai]>=1.1.1"
diff --git a/tox.ini b/tox.ini
index bb2abd9..bfa9b64 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,33 +3,21 @@ skipsdist = True
 usedevelop = True
 
 envlist =
-    python{3.8,3.9}-django{3.2}-wagtail{4.1,4.2}-{sqlite,postgres}
-    python{3.10}-django{3.2}-wagtail{4.1,4.2,main}-{sqlite,postgres}
-    python{3.8,3.9,3.10}-django{4.0}-wagtail{4.1,4.2,main}-{sqlite,postgres}
-    python{3.8,3.9,3.10,3.11}-django{4.1,main}-wagtail{4.1,4.2,main}-{sqlite,postgres}
-    python{3.8,3.9,3.10,3.11}-django{4.2,main}-wagtail{5.0,5.1,main}-{sqlite,postgres}
+    python{3.11,3.12}-django{4.2}-wagtail{5.2}-{sqlite,postgres}
+    python{3.12}-django{main}-wagtail{main}-{sqlite,postgres}
 
 [testenv]
 commands = pytest {posargs}
 
 basepython =
-    python3.8: python3.8
-    python3.9: python3.9
-    python3.10: python3.10
     python3.11: python3.11
     python3.12: python3.12
 
 deps =
-    django3.2: Django>=3.2,<4.0
-    django4.0: Django>=4.0,<4.1
-    django4.1: Django>=4.1,<4.2
     django4.2: Django>=4.2,<4.3
     djangomain: git+https://github.com/django/django.git@main#egg=Django
 
-    wagtail4.1: wagtail>=4.1,<4.2
-    wagtail4.2: wagtail>=4.2,<4.3
-    wagtail5.0: wagtail>=5.0,<5.1
-    wagtail5.1: wagtail>=5.1,<5.2
+    wagtail5.2: wagtail>=5.2,<6.0
     wagtailmain: git+https://github.com/wagtail/wagtail.git
 
     postgres: psycopg2>=2.6
@@ -40,10 +28,10 @@ setenv =
     postgres: DATABASE_URL={env:DATABASE_URL:postgres:///wagtail_ai}
 
 [testenv:interactive]
-basepython = python3.10
+basepython = python3.11
 
 deps =
-    wagtail>=5.1
+    wagtail>=5.2
     .[testing]
 
 commands_pre =


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 17fb39b..1de77a2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -36,16 +36,10 @@ jobs:
     needs: lint
     strategy:
       matrix:
-        python: ['3.8', '3.9']
-        django: ['3.2']
-        wagtail: ['4.1', '4.2']
-        include:
-          - python: '3.10'
-            django: '4.2'
-            wagtail: '5.1'
-          - python: '3.11'
-            django: '4.2'
-            wagtail: '5.1'
+        python: ['3.11', '3.12']
+        django: ['4.2']
+        wagtail: ['5.2']
+        experimental: [false]
 
     steps:
       - uses: actions/checkout@v3
@@ -68,17 +62,10 @@ jobs:
     needs: lint
     strategy:
       matrix:
-        python: ['3.8', '3.9']
-        django: ['3.2']
-        wagtail: ['4.1', '4.2']
+        python: ['3.11', '3.12']
+        django: ['4.2']
+        wagtail: ['5.2']
         experimental: [false]
-        include:
-          - python: '3.10'
-            django: '4.2'
-            wagtail: '5.1'
-          - python: '3.11'
-            django: '4.2'
-            wagtail: '5.1'
 
     services:
       postgres:
diff --git a/tests/testapp/settings.py b/tests/testapp/settings.py
index df6a482..1fe0d68 100644
--- a/tests/testapp/settings.py
+++ b/tests/testapp/settings.py
@@ -45,7 +45,6 @@
     "wagtail.search",
     "wagtail.admin",
     "wagtail.api.v2",
-    "wagtail.contrib.modeladmin",
     "wagtail.contrib.routable_page",
     "wagtail.contrib.styleguide",
     "wagtail.sites",