diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b22e6a..7fd3edd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ env: TOX_TESTENV_PASSENV: FORCE_COLOR PIP_DISABLE_PIP_VERSION_CHECK: "1" PIP_NO_PYTHON_VERSION_WARNING: "1" - PYTHON_LATEST: "3.12" + PYTHON_LATEST: "3.13" jobs: tests: @@ -27,7 +27,7 @@ jobs: strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Harden Runner @@ -37,10 +37,13 @@ jobs: egress-policy: block allowed-endpoints: > files.pythonhosted.org:443 + objects.githubusercontent.com:443 github.com:443 pypi.org:443 api.github.com:443 - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -58,6 +61,7 @@ jobs: with: name: coverage-data-${{ matrix.python-version }} path: .coverage.* + include-hidden-files: true if-no-files-found: ignore retention-days: 1 @@ -73,10 +77,13 @@ jobs: egress-policy: block allowed-endpoints: > files.pythonhosted.org:443 + objects.githubusercontent.com:443 github.com:443 pypi.org:443 api.github.com:443 - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: # Use latest Python, so it understands all syntax. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4251783..33e1344 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,6 +23,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + persist-credentials: false # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/nightly-tests.yaml b/.github/workflows/nightly-tests.yaml index e899233..4ce4a9b 100644 --- a/.github/workflows/nightly-tests.yaml +++ b/.github/workflows/nightly-tests.yaml @@ -16,14 +16,15 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.12 + with: + persist-credentials: false + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install --upgrade tox + python -m pip install --upgrade pip tox - name: Test id: test continue-on-error: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fb44e4c..f96af44 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,11 +13,12 @@ jobs: steps: - uses: actions/checkout@v4 with: + persist-credentials: false fetch-depth: 0 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' cache: "pip" cache-dependency-path: "**/pyproject.toml" diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 954e52d..2473854 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -13,10 +13,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - run: python -Im pip install --user ruff - - - name: Run ruff - working-directory: ./src - run: ruff --output-format=github wagtailmarkdown + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install dependencies + # keep in sync with .pre-commit-config.yaml + run: python -Im pip install --user ruff==0.8.2 + - name: Run Ruff + run: ruff check --output-format=github ./src/wagtailmarkdown diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a1d61c..5cffd5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,11 +3,11 @@ ci: autoupdate_schedule: 'quarterly' default_language_version: - python: python3.12 + python: python3.13 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -20,7 +20,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.3.0' + rev: 'v0.8.2' # keep in sync with .github/workflows/ruff.yml hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a82ec..dab35df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +- Add tox testing for wagtail 6.2 and 6.3 and include Django 5.1 +- Update the ruff github action which fixes the error seen in CI + ## [0.12.1] - 2024-03-09 ### Fixed diff --git a/README.md b/README.md index 111857f..a2c4774 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,7 @@ And render the content in a template: ## Compatibility -wagtail-markdown supports Wagtail 4.1 and above, python-markdown 3.3 and above. +wagtail-markdown supports Wagtail 5.2 and above, python-markdown 3.3 and above. ## Contributing @@ -347,11 +347,11 @@ tox -p To run tests for a specific environment: ```shell -tox -e py312-django5.0-wagtail6.0 +tox -e py313-django5.1-wagtail6.3 ``` or, a specific test ```shell -tox -e py312-django5.0-wagtail6.0 -- tests.testapp.tests.test_admin.TestFieldsAdmin +tox -e py313-django5.1-wagtail6.3 -- tests.testapp.tests.test_admin.TestFieldsAdmin ``` diff --git a/pyproject.toml b/pyproject.toml index 666b425..97896d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,22 +14,22 @@ classifiers = [ "License :: OSI Approved :: zlib/libpng License", "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", + "Programming Language :: Python :: 3.13", "Framework :: Django", - "Framework :: Django :: 3.2", "Framework :: Django :: 4.2", "Framework :: Django :: 5.0", + "Framework :: Django :: 5.1", "Framework :: Wagtail", "Framework :: Wagtail :: 5", "Framework :: Wagtail :: 6", ] dynamic = ["version"] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "Wagtail>=5.2", "Markdown>=3.3,<4", diff --git a/src/wagtailmarkdown/mdx/linkers/image.py b/src/wagtailmarkdown/mdx/linkers/image.py index 7d5bc2e..ea853bb 100644 --- a/src/wagtailmarkdown/mdx/linkers/image.py +++ b/src/wagtailmarkdown/mdx/linkers/image.py @@ -33,7 +33,7 @@ def run(self, fname, options): opts["classname"] = "full-width" elif opt == "width": with contextlib.suppress(ValueError): - opts["spec"] = "width-%d" % int(value) + opts["spec"] = f"width-{int(value)}" try: image = get_image_model().objects.get(title=fname) diff --git a/tox.ini b/tox.ini index 10b4dd5..abe0964 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,18 @@ [tox] -min_version = 4.0 +min_version = 4.22 envlist = - py{38,39,310}-django3.2-wagtail5.2 - py{38,39,310,311}-django4.2-wagtail{5.2,6.0} - py{311,312}-django5.0-wagtail{5.2,6.0,main} + py{39,310,311}-dj42-wagtail{52,63} + py{310,311}-dj50-wagtail{52,62,63} + py{312,313}-dj51-wagtail63 [gh-actions] python = - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 3.12: py312 + 3.13: py313 [testenv] package = editable @@ -24,23 +24,27 @@ setenv = PYTHONPATH = {toxinidir} DJANGO_SETTINGS_MODULE = tests.testapp.settings PYTHONDEVMODE = 1 + # use the Python 3.12+ sys.monitoring + py3.12: COVERAGE_CORE=sysmon + py3.13: COVERAGE_CORE=sysmon extras = testing deps = - django3.2: Django>=3.2,<4.0 django4.2: Django>=4.2,<5.0 django5.0: Django>=5.0,<5.1 + django5.1: Django>=5.1,<5.2 wagtail5.2: wagtail>=5.2,<5.3 - wagtail6.0: wagtail>=6.0,<6.1 + wagtail6.2: wagtail>=6.2,<6.3 + wagtail6.3: wagtail>=6.3,<6.4 install_command = python -m pip install -U {opts} {packages} commands = python -m coverage run {toxinidir}/tests/manage.py test {posargs: -v 2} [testenv:coverage-report] -base_python = python3.12 +base_python = python3.13 package = skip deps = coverage>=7.0,<8.0 @@ -50,14 +54,14 @@ commands = [testenv:wagtailmain] description = Test with latest Wagtail main branch -base_python = python3.12 +base_python = python3.13 deps = coverage>=7.0,<8.0 wagtailmain: git+https://github.com/wagtail/wagtail.git@main#egg=Wagtail [testenv:interactive] description = An interactive environment for local testing purposes -base_python = python3.12 +base_python = python3.13 ; Note: the following are commented out for development convenience, ; so as to test the interactive mode with a different Wagtail version