diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 505a6d0..6c2ddbc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11"] + python: ["3.9", "3.10", "3.11", "3.12"] database: ["sqlite"] steps: - uses: actions/checkout@v3 @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11"] + python: ["3.9", "3.10", "3.11", "3.12"] database: ["postgres"] services: postgres: @@ -85,7 +85,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11"] + python: ["3.9", "3.10", "3.11", "3.12"] database: ["mysql"] services: mariadb: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3a186ff..e386267 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ repos: - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.1.0 hooks: - id: flake8 - repo: https://github.com/jackdewinter/pymarkdown @@ -23,4 +23,4 @@ repos: rev: 1.16.0 hooks: - id: blacken-docs - additional_dependencies: [black==23.7.0] + additional_dependencies: [black==24.4.2] diff --git a/CHANGELOG.md b/CHANGELOG.md index d457164..7bf6fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [2.1.0] - 2024-07-14 + +- Add testing for Wagtail 5.2 & 6.0 +- Add testing for Django 5.0 +- Add testing for Python 3.12 + ## [2.0.0] - 2023-08-01 - [General tidy up around tests and docs](https://github.com/nickmoreton/wagtail-qrcode/pull/28) diff --git a/Makefile b/Makefile index 4473f1c..0b7729b 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ test: mail: @echo "Starting mail server" - @cp wagtail_qrcode/test/local.py.example wagtail_qrcode/test/local.py + @cp tests/local.py.example tests/local.py @docker run -d -p 8025:8025 -p 1025:1025 --name mailhog mailhog/mailhog @make run diff --git a/docs/contrubute.md b/docs/contrubute.md index 94beb33..eb10dcc 100644 --- a/docs/contrubute.md +++ b/docs/contrubute.md @@ -11,13 +11,14 @@ git clone https://github.com/nickmoreton/wagtail-qrcode ## Setup a virtual environment ```bash -pyenv virtualenv wagtail-qrcode && pyenv activate wagtail-qrcode +python3 -m venv venv +source venv/bin/activate ``` ## Install the package into your virtual environment ```bash -pip install -e ".[testing]" +pip install -e ".[development,testing]" ``` ## Setup the testing app diff --git a/pyproject.toml b/pyproject.toml index 3a33da2..4b2d040 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,55 @@ +[project] +name = "wagtail-qrcode" +version = "2.1.0" +description = "Create a QR code that can be used to link to a wagtail page" +readme = "README.md" +keywords = ["wagtail", "qrcode"] +authors = [ + {name = "Nick Moreton", email = "nickmoreton@me.com"} +] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Framework :: Wagtail", + "Framework :: Wagtail :: 4", + "Framework :: Wagtail :: 5", + "Framework :: Wagtail :: 6", +] +requires-python = ">=3.9" +dependencies =[ + "Wagtail>=4.1", + "PyQRCode>=1,<2" +] + +[project.optional-dependencies] +development = [ + "black==24.4.2", + "flake8==7.1.0", + "isort==5.13.0", +] +testing = [ + "coverage" +] + +[project.urls] +Repository = "https://github.com/wagtail-packages/wagtail-qrcode" +Issues = "https://github.com/wagtail-packages/wagtail-qrcode/issues" +Changelog = "https://github.com/wagtail-packages/wagtail-qrcode/blob/release/CHANGELOG.md" + + [tool.black] line-length = 88 target-version = ['py39'] diff --git a/setup.py b/setup.py deleted file mode 100644 index 5892dc2..0000000 --- a/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -from os import path - -from setuptools import find_packages, setup - -from wagtail_qrcode import __version__ - -this_directory = path.abspath(path.dirname(__file__)) -with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: - long_description = f.read() - -setup( - name="wagtail-qrcode", - version=__version__, - description="Create a QR code that can be used to link to a wagtail page", - long_description=long_description, - long_description_content_type="text/markdown", - author="Nick Moreton", - author_email="nickmoreton@me.com", - url="https://github.com/nickmoreton/wagtail-qrcode", - packages=find_packages(), - include_package_data=True, - license="MIT", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "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", - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - "Framework :: Wagtail", - "Framework :: Wagtail :: 4", - "Framework :: Wagtail :: 5", - ], - install_requires=["Wagtail>=4.1", "PyQRCode>=1,<2"], - extras_require={ - "testing": ["coverage"], - }, - zip_safe=False, -) diff --git a/tests/settings.py b/tests/settings.py index 07c1b8b..13a01a1 100644 --- a/tests/settings.py +++ b/tests/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", diff --git a/tox.ini b/tox.ini index 66efea7..c9d5070 100644 --- a/tox.ini +++ b/tox.ini @@ -4,15 +4,15 @@ usedevelop = True skip_missing_interpreters = True envlist = - py{38,39,310}-dj{32,41}-wt{41,42,50,51,52}-{sqlite,postgres,mysql} - py{311}-dj{42}-wt{50,51,52}-{sqlite,postgres,mysql} + py39-dj32-wt41-{sqlite,postgres,mysql} + py{310,311,312}-dj{42,50}-wt{52,60,61}-{sqlite,postgres,mysql} [gh-actions] python = - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 [gh-actions:env] DATABASE = @@ -32,14 +32,16 @@ deps = coverage dj32: Django>=3.2,<4.0 - dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<4.3 + dj50: Django>=5.0,<5.1 wt41: Wagtail>=4.1,<4.2 wt42: Wagtail>=4.2,<5.0 wt50: Wagtail>=5.0,<5.1 wt51: Wagtail>=5.1,<5.2 wt52: Wagtail>=5.2,<5.3 + wt60: Wagtail>=6.0,<6.1 + wt61: Wagtail>=6.1,<6.2 postgres: psycopg2 mysql: mysqlclient diff --git a/wagtail_qrcode/__init__.py b/wagtail_qrcode/__init__.py index 7dd08b2..e69de29 100644 --- a/wagtail_qrcode/__init__.py +++ b/wagtail_qrcode/__init__.py @@ -1,2 +0,0 @@ -VERSION = (2, 0, 0) -__version__ = ".".join(map(str, VERSION)) diff --git a/wagtail_qrcode/wagtail_hooks.py b/wagtail_qrcode/wagtail_hooks.py index 62cc567..992b629 100644 --- a/wagtail_qrcode/wagtail_hooks.py +++ b/wagtail_qrcode/wagtail_hooks.py @@ -55,7 +55,7 @@ def send_qr_code_email(page, email=None, subject=None, body=None): @hooks.register("after_delete_page") def delete_document(request, page): - if is_qrcode_instance(page): + if is_qrcode_instance(page) and page.qr_code_eps: doc = get_document_model().objects.filter(id=page.qr_code_eps.id) if doc: doc.delete()