Skip to content

Commit 3fb2f40

Browse files
authored
Wagtail 7.0+ maintenance (#18)
1 parent 2a977b5 commit 3fb2f40

9 files changed

Lines changed: 47 additions & 122 deletions

File tree

.github/workflows/ruff.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ 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.15.16
2021

2122
- name: Run ruff
2223
working-directory: ./src
23-
run: ruff --output-format=github wagtailmath
24+
run: ruff check --output-format=github wagtailmath

.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.15.16
2424
hooks:
25-
- id: ruff
25+
- id: ruff-check
2626
args: [--fix]
2727
- id: ruff-format

pyproject.toml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ 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"}
@@ -15,35 +16,35 @@ classifiers = [
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",
2425
"Framework :: Django :: 4.2",
25-
"Framework :: Django :: 5.0",
26+
"Framework :: Django :: 5.2",
27+
"Framework :: Django :: 6.0",
2628
"Framework :: Wagtail",
27-
"Framework :: Wagtail :: 5",
28-
"Framework :: Wagtail :: 6",
29+
"Framework :: Wagtail :: 7",
2930
]
30-
requires-python = ">=3.8"
31+
requires-python = ">=3.10"
3132
dynamic = ["version"]
3233
dependencies = [
3334
"Django>=4.2",
34-
"Wagtail>=5.2"
35+
"Wagtail>=7.0"
3536
]
3637
[project.optional-dependencies]
37-
linting = ["pre-commit>=3.6.0,<4",]
38+
linting = ["pre-commit>=4.6.0,<5",]
3839
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",
40+
"dj-database-url==3.1.2",
41+
"pytest==9.0.3",
42+
"pytest-cov==7.1.0",
43+
"pytest-django==4.12.0",
4344
]
4445
ci = [
45-
"tox>=4.15.1,<5",
46-
"tox-gh-actions>=3.2,<3.3",
46+
"tox>=4.55.1,<5",
47+
"tox-gh-actions>=3.5,<4",
4748
]
4849

4950
[project.urls]

src/wagtailmath/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.3.0"
1+
__version__ = "1.3.1"

src/wagtailmath/models.py

Whitespace-only changes.

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: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,25 @@
11
from django import forms
2-
from wagtail import VERSION as WAGTAIL_VERSION
32
from wagtail.admin.staticfiles import versioned_static
43

54

65
MATHJAX_VERSION = "2.7.9"
76

87

9-
class MathJaxWidgetBase(forms.Textarea):
8+
class MathJaxWidget(forms.Textarea):
109
template_name = "wagtailmath/mathjaxwidget.html"
1110

12-
def _get_media_js(self):
13-
return (
14-
f"https://cdnjs.cloudflare.com/ajax/libs/mathjax/{MATHJAX_VERSION}/MathJax.js?config=TeX-MML-AM_HTMLorMML",
15-
versioned_static("wagtailmath/js/wagtailmath.js"),
16-
)
11+
def build_attrs(self, *args, **kwargs):
12+
attrs = super().build_attrs(*args, **kwargs)
13+
attrs["data-controller"] = "wagtailmathjax"
14+
15+
return attrs
1716

1817
@property
1918
def media(self):
20-
return forms.Media(js=self._get_media_js())
21-
22-
23-
if WAGTAIL_VERSION >= (6, 0):
24-
25-
class MathJaxWidget(MathJaxWidgetBase):
26-
def build_attrs(self, *args, **kwargs):
27-
attrs = super().build_attrs(*args, **kwargs)
28-
attrs["data-controller"] = "wagtailmathjax"
29-
30-
return attrs
31-
32-
def _get_media_js(self):
33-
return (
34-
*super()._get_media_js(),
19+
return forms.Media(
20+
js=(
21+
f"https://cdnjs.cloudflare.com/ajax/libs/mathjax/{MATHJAX_VERSION}/MathJax.js?config=TeX-MML-AM_HTMLorMML",
22+
versioned_static("wagtailmath/js/wagtailmath.js"),
3523
versioned_static("wagtailmath/js/wagtailmath-mathjax-controller.js"),
3624
)
37-
else:
38-
from wagtail.telepath import register
39-
from wagtail.utils.widgets import WidgetWithScript
40-
from wagtail.widget_adapters import WidgetAdapter
41-
42-
class MathJaxWidget(WidgetWithScript, MathJaxWidgetBase):
43-
def render_js_init(self, id_, name, value):
44-
return f'initMathJaxPreview("{id_}");'
45-
46-
class MathJaxAdapter(WidgetAdapter):
47-
js_constructor = "wagtailmath.widgets.MathJaxWidget"
48-
49-
class Media:
50-
# TODO: remove the adapter when dropping support for Wagtail 5.2
51-
js = ["wagtailmath/js/mathjax-textarea-adapter.js"]
52-
53-
register(MathJaxAdapter(), MathJaxWidget)
25+
)

tox.ini

Lines changed: 13 additions & 9 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
@@ -34,10 +36,12 @@ deps =
3436
coverage>=7.0,<8.0
3537

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

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

4246
extras = testing
4347

@@ -53,7 +57,7 @@ basepython = python3.12
5357
package = editable
5458

5559
deps =
56-
wagtail >= 5.2, <6.0
60+
wagtail >= 7.0, < 7.1
5761

5862
commands_pre =
5963
python {toxinidir}/tests/manage.py makemigrations

0 commit comments

Comments
 (0)