Skip to content

Commit 796cfec

Browse files
committed
Drop support for Python < 3.10, Django < 5.2, Wagtail < 7.0
1 parent 0a3ff9f commit 796cfec

8 files changed

Lines changed: 52 additions & 129 deletions

File tree

.github/workflows/ruff.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ on:
1010

1111
jobs:
1212
ruff:
13+
name: Ruff
1314
runs-on: ubuntu-latest
1415

1516
steps:
1617
- uses: actions/checkout@v4
1718

1819
# Keep in sync with .pre-comit-config.yaml
19-
- run: python -Im pip install --user ruff==0.4.9
20+
- run: python -Im pip install --user ruff==0.16.0
2021

2122
- name: Run ruff
2223
working-directory: ./src

.github/workflows/test.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,11 @@ permissions:
1616
contents: read # to fetch code (actions/checkout)
1717

1818
jobs:
19-
lint:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
- name: Set up Python 3.12
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: '3.12'
29-
- uses: pre-commit/action@v3.0.1
30-
3119
test-sqlite:
3220
runs-on: ubuntu-latest
33-
needs: lint
3421
strategy:
3522
matrix:
36-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
23+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
3724

3825
steps:
3926
- uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ default_language_version:
66

77
repos:
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.6.0
9+
rev: v6.0.0
1010
hooks:
1111
- id: check-added-large-files
1212
- id: check-case-conflict
@@ -20,8 +20,8 @@ repos:
2020
- id: trailing-whitespace
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
2222
# ruff config is in ruff.toml. Keep in sync with .github/workflows/ruff.yml
23-
rev: v0.4.9
23+
rev: v0.16.0
2424
hooks:
25-
- id: ruff
25+
- id: ruff-check
2626
args: [--fix]
2727
- id: ruff-format

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Unreleased
44

5-
## 1.4.0 (2026-08-05)
5+
## 1.4.0 (2026-08-06)
66

7+
- Dropped support for Python < 3.10, Django < 5.2, Wagtail < 7.0
78
- Added a `WAGTAIL_POLYMATH` settings dict, with `mathjax_url` and `mathjax_sri` keys, to allow
89
loading MathJax from a different CDN, or self-hosted, instead of the pinned cdnjs default.
910
See [Configuration](README.md#configuration)

pyproject.toml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,45 @@ build-backend = "flit_core.buildapi"
55
[project]
66
name = "wagtailmath"
77
authors = [{name = "James Ramm", email = "jamessramm@gmail.com"}]
8+
maintainers = [{name = "Wagtail Nest team", email = "hello@wagtail.org"}]
89
description = "Wagtail StreamField block for rendering mathematical equations"
910
readme = "README.md"
1011
license = {file = "LICENSE"}
1112
classifiers = [
12-
"Development Status :: 3 - Alpha",
13+
"Development Status :: 4 - Beta",
1314
"Intended Audience :: Developers",
1415
"License :: OSI Approved :: BSD License",
1516
"Operating System :: OS Independent",
1617
"Programming Language :: Python",
1718
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.8",
19-
"Programming Language :: Python :: 3.9",
2019
"Programming Language :: Python :: 3.10",
2120
"Programming Language :: Python :: 3.11",
2221
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
2324
"Framework :: Django",
24-
"Framework :: Django :: 4.2",
25-
"Framework :: Django :: 5.0",
25+
"Framework :: Django :: 5.2",
26+
"Framework :: Django :: 6.0",
2627
"Framework :: Wagtail",
27-
"Framework :: Wagtail :: 5",
28-
"Framework :: Wagtail :: 6",
28+
"Framework :: Wagtail :: 7",
2929
]
30-
requires-python = ">=3.8"
30+
requires-python = ">=3.10"
3131
dynamic = ["version"]
3232
dependencies = [
33-
"Django>=4.2",
34-
"Wagtail>=5.2"
33+
"Django>=5.2",
34+
"Wagtail>=7.0"
3535
]
3636
[project.optional-dependencies]
3737
linting = ["pre-commit>=3.6.0,<4",]
3838
testing = [
39-
"dj-database-url==2.1.0",
40-
"pytest==8.1.1",
41-
"pytest-cov==5.0.0",
42-
"pytest-django==4.8.0",
39+
"dj-database-url==3.1.2",
40+
"pytest==9.1.1",
41+
"pytest-cov==7.1.0",
42+
"pytest-django==4.13.0",
4343
]
4444
ci = [
45-
"tox>=4.15.1,<5",
46-
"tox-gh-actions>=3.2,<3.3",
45+
"tox>=4.55.1,<5",
46+
"tox-gh-actions>=3.5,<4",
4747
]
4848

4949
[project.urls]

src/wagtailmath/static/wagtailmath/js/mathjax-textarea-adapter.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/wagtailmath/widgets.py

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from django import forms
22
from django.forms.utils import flatatt
33
from django.utils.html import format_html
4-
from wagtail import VERSION as WAGTAIL_VERSION
54
from wagtail.admin.staticfiles import versioned_static
65

76
from .settings import wagtail_polymath_settings
@@ -44,59 +43,31 @@ def __hash__(self):
4443
return hash((self.src, tuple(sorted(self.attributes.items()))))
4544

4645

47-
class MathJaxWidgetBase(forms.Textarea):
46+
class MathJaxWidget(forms.Textarea):
4847
template_name = "wagtailmath/mathjaxwidget.html"
4948

50-
def _get_media_js(self):
49+
def build_attrs(self, *args, **kwargs):
50+
attrs = super().build_attrs(*args, **kwargs)
51+
attrs["data-controller"] = "wagtailmathjax"
52+
53+
return attrs
54+
55+
@property
56+
def media(self):
5157
# PORT NOTE: 2.x also passes defer=True here. We can't: wagtailmath.js
5258
# and the Stimulus controller are not deferred, and
5359
# initMathJaxPreview() calls MathJax.Callback() as soon as it runs, so
5460
# deferring only the CDN script would leave MathJax undefined at that
5561
# point and break the live preview.
5662
attributes = {}
57-
integrity = wagtail_polymath_settings.mathjax_sri
58-
if integrity:
63+
if integrity := wagtail_polymath_settings.mathjax_sri:
5964
attributes["crossorigin"] = "anonymous"
6065
attributes["integrity"] = integrity
6166

62-
return (
63-
Script(wagtail_polymath_settings.mathjax_url, **attributes),
64-
versioned_static("wagtailmath/js/wagtailmath.js"),
65-
)
66-
67-
@property
68-
def media(self):
69-
return forms.Media(js=self._get_media_js())
70-
71-
72-
if WAGTAIL_VERSION >= (6, 0):
73-
74-
class MathJaxWidget(MathJaxWidgetBase):
75-
def build_attrs(self, *args, **kwargs):
76-
attrs = super().build_attrs(*args, **kwargs)
77-
attrs["data-controller"] = "wagtailmathjax"
78-
79-
return attrs
80-
81-
def _get_media_js(self):
82-
return (
83-
*super()._get_media_js(),
67+
return forms.Media(
68+
js=(
69+
Script(wagtail_polymath_settings.mathjax_url, **attributes),
70+
versioned_static("wagtailmath/js/wagtailmath.js"),
8471
versioned_static("wagtailmath/js/wagtailmath-mathjax-controller.js"),
8572
)
86-
else:
87-
from wagtail.telepath import register
88-
from wagtail.utils.widgets import WidgetWithScript
89-
from wagtail.widget_adapters import WidgetAdapter
90-
91-
class MathJaxWidget(WidgetWithScript, MathJaxWidgetBase):
92-
def render_js_init(self, id_, name, value):
93-
return f'initMathJaxPreview("{id_}");'
94-
95-
class MathJaxAdapter(WidgetAdapter):
96-
js_constructor = "wagtailmath.widgets.MathJaxWidget"
97-
98-
class Media:
99-
# TODO: remove the adapter when dropping support for Wagtail 5.2
100-
js = ["wagtailmath/js/mathjax-textarea-adapter.js"]
101-
102-
register(MathJaxAdapter(), MathJaxWidget)
73+
)

tox.ini

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
[tox]
2-
min_version = 4.11
2+
min_version = 4.30
33

44
envlist =
5-
python{3.8,3.9,3.10,3.11}-django{4.2}-wagtail{5.2,6.1}-{sqlite}
6-
python{3.10,3.11,3.12}-django{5.0}-wagtail{5.2,6.1}-{sqlite}
5+
python{3.10}-django{4.2}-wagtail{7.0}-{sqlite}
6+
python{3.11,3.12}-django{5.2}-wagtail{7.0,7.4}-{sqlite}
7+
python{3.13,3.14}-django{6.0}-wagtail{7.4}-{sqlite}
8+
python{3.14}-django{6.0}-wagtail{main}-{sqlite}
79

810
[gh-actions]
911
python =
10-
3.8: python3.8
11-
3.9: python3.9
1212
3.10: python3.10
1313
3.11: python3.11
1414
3.12: python3.12
15+
3.13: python3.13
16+
3.14: python3.14
1517

1618
[testenv]
1719
package = wheel
@@ -33,11 +35,12 @@ setenv =
3335
deps =
3436
coverage>=7.0,<8.0
3537

36-
django4.2: Django>=4.2,<4.3
37-
django5.0: Django>=5.0,<5.1
38+
django5.2: Django>=5.2,<5.3
39+
django6.0: Django>=6.0,<6.1
3840

39-
wagtail5.2: wagtail>=5.2,<5.3
40-
wagtail6.1: wagtail>=6.1,<6.2
41+
wagtail7.0: wagtail>=7.0,<7.1
42+
wagtail7.3: wagtail>=7.3,<7.4
43+
wagtail7.4: wagtail>=7.4,<7.5
4144

4245
extras = testing
4346

@@ -53,7 +56,7 @@ basepython = python3.12
5356
package = editable
5457

5558
deps =
56-
wagtail >= 5.2, <6.0
59+
wagtail >= 7.0, <7.1
5760

5861
commands_pre =
5962
python {toxinidir}/tests/manage.py makemigrations

0 commit comments

Comments
 (0)