Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4e7dce6
add aria-hidden to exlude honeypot field
Mar 17, 2026
f68371e
Clarify release branch workflow
nickmoreton Apr 20, 2026
1c87b60
Adopt uv for contributor workflow
nickmoreton Apr 20, 2026
116614b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 20, 2026
75e3785
Add Makefile help target
nickmoreton Apr 20, 2026
df99298
Migrate code formatting checks to Ruff
nickmoreton Apr 20, 2026
9fe137b
Update agent instructions and changelog
nickmoreton Apr 20, 2026
3282caf
Update agent instructions and changelog guidance
nickmoreton Apr 20, 2026
dd79b6d
Update honeypot field docs for aria-hidden
nickmoreton Apr 20, 2026
7cb5fb5
Refactor and strengthen honeypot tests
nickmoreton Apr 20, 2026
cdf8a35
Pin ruff and run fixes in format target
nickmoreton Apr 20, 2026
07b0fae
correct indent
nickmoreton Apr 20, 2026
1d46eaa
adjust glob
nickmoreton Apr 20, 2026
973fe7a
Simplify honeypot submission checks
nickmoreton Apr 20, 2026
0324c49
Require review fix commits and push follow-up replies
nickmoreton Apr 20, 2026
5256284
Limit release PR tox matrix
nickmoreton Apr 20, 2026
def2afc
Merge pull request #48 from nm-packages/codex/release-work
nickmoreton Apr 20, 2026
08b6204
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 20, 2026
9de2068
Add Wagtail 7.3 test coverage
nickmoreton Apr 20, 2026
d8000b0
Use uvx for CI tox jobs
nickmoreton Apr 20, 2026
4a96631
Merge pull request #50 from nm-packages/pre-commit-ci-update-config
nickmoreton Apr 20, 2026
c0f9633
Merge pull request #51 from nm-packages/codex/wagtail-7-3-testing
nickmoreton Apr 20, 2026
8d7619b
Add GitHub Actions PyPI release workflow
nickmoreton Apr 20, 2026
a7dcfc3
Align PyPI release flow with trusted publishing
nickmoreton Apr 21, 2026
d0b9172
Merge pull request #52 from nm-packages/codex/pypi-release-workflow
nickmoreton Apr 21, 2026
6362d16
Update AGENTS release guidance
nickmoreton Apr 21, 2026
be8ec33
Merge pull request #53 from nm-packages/codex/update-agents-release-g…
nickmoreton Apr 21, 2026
8ba2129
Prepare 1.3.0 release
nickmoreton Apr 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
release:
types: [published]

permissions:
contents: read
id-token: write

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Set up uv
uses: astral-sh/setup-uv@v8.1.0
with:
enable-cache: true

- name: Validate release tag matches package version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
PACKAGE_VERSION="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
EXPECTED_TAG="v${PACKAGE_VERSION}"

if [ "${RELEASE_TAG}" != "${EXPECTED_TAG}" ]; then
echo "Release tag ${RELEASE_TAG} does not match expected tag ${EXPECTED_TAG} derived from project version ${PACKAGE_VERSION}."
exit 1
fi

- name: Validate release commit is on main
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
git fetch --no-tags origin main
RELEASE_SHA="$(git rev-list -n 1 "refs/tags/${RELEASE_TAG}")"

if ! git merge-base --is-ancestor "${RELEASE_SHA}" origin/main; then
echo "Release tag ${RELEASE_TAG} points to commit ${RELEASE_SHA}, which is not contained in origin/main."
exit 1
fi

- name: Build source distribution and wheel
run: uv build --sdist --wheel --out-dir dist

- name: Validate built artifacts
run: uvx twine check dist/*

- name: Upload built distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build

steps:
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
79 changes: 45 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,34 @@ concurrency:
cancel-in-progress: true

jobs:
test-sqlite:
test-sqlite-release:
if: github.base_ref == 'release'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python: "3.10"
toxenv: py310-django42-wagtail63-sqlite
- python: "3.14"
toxenv: py314-django60-wagtail73-sqlite

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up uv
id: setup-uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python }}
enable-cache: true

- name: Test with tox
id: test-with-tox
run: uvx --with tox-gh-actions tox -e ${{ matrix.toxenv }}

test-sqlite-main:
if: github.base_ref == 'main'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,26 +49,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
- name: Set up uv
id: setup-uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
id: install-dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
enable-cache: true

- name: Test with tox
id: test-with-tox
run: |
tox
run: uvx --with tox-gh-actions tox
env:
DATABASE: ${{ matrix.database }}

test-postgres:
if: github.base_ref == 'main'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -63,22 +85,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
- name: Set up uv
id: setup-uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
id: install-dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
enable-cache: true

- name: Test with tox
id: test-with-tox
run: |
tox
run: uvx --with tox-gh-actions tox
env:
DB_NAME: postgres
DB_USER: postgres
Expand All @@ -89,6 +105,7 @@ jobs:


test-mysql:
if: github.base_ref == 'main'
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -112,22 +129,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
id: setup-python
uses: actions/setup-python@v4
- name: Set up uv
id: setup-uv
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
id: install-dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
enable-cache: true

- name: Test with tox
id: test-with-tox
run: |
tox
run: uvx --with tox-gh-actions tox
env:
DB_NAME: mysql
DB_USER: root
Expand Down
30 changes: 12 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 7.0.0
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.7
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 25.11.0
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.11
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
- id: ruff-check
args: [--fix]
- id: ruff-format
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.33
rev: v0.9.36
hooks:
- id: pymarkdown
args:
- --disable-rules
- line-length
- scan
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.1
hooks:
- id: pyupgrade
- repo: https://github.com/adamchainz/django-upgrade
rev: "1.29.1" # replace with latest tag on GitHub
rev: "1.30.0" # replace with latest tag on GitHub
hooks:
- id: django-upgrade
args: [--target-version, "5.2"] # Replace with Django version
- id: django-upgrade
args: [--target-version, "5.2"] # Replace with Django version
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
82 changes: 82 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Agent Conventions

## Purpose

This file guides coding agents working in this repository. Keep it operational and project-specific. Use `README.md` for package usage, `docs/developer.md` for local setup details, and `docs/contributing/releasing.md` for maintainer release steps; do not duplicate those walkthroughs here.

## Workflow Tools

- Use `uv` for contributor and agent workflows by default.
- Use `uv sync` to create or refresh the local environment.
- Use `uv run ...` for project commands instead of bare `python`, `pip`, or globally installed tooling unless the task explicitly requires it.
- Use Ruff for Python formatting and linting by default.

## Repo Map

- `wagtail_honeypot/`: package behavior and public implementation.
- `wagtail_honeypot/models.py`: honeypot settings defaults and form submission logic.
- `wagtail_honeypot/templatetags/honeypot_tags.py`: template tag context and field names.
- `wagtail_honeypot/templates/` and `wagtail_honeypot/static/`: rendered markup and browser-side behavior.
- `wagtail_honeypot/locale/`: translations.
- `tests/`: unit coverage for models, methods, forms, and template tags.
- `tests/testapp/`: minimal Wagtail integration site; use it only when a change needs page-level or form-flow coverage.

## Change Conventions

- Put reusable package behavior in `wagtail_honeypot/`, not in `tests/testapp/`.
- Change `models.py` when adjusting honeypot defaults, settings handling, or form submission decisions.
- Change `templatetags/honeypot_tags.py` and `templates/tags/honeypot_fields.html` when adjusting rendered field names, context, or markup.
- Change `static/css/` or `static/js/` only for browser behavior related to hiding or presenting honeypot fields.
- Update `locale/` only when user-facing strings change.
- Keep `tests/testapp/` focused on integration behavior; do not treat it as a second implementation surface.

## Compatibility Rules

- Preserve existing `HONEYPOT_*` setting names and behavior unless the task explicitly changes support policy.
- Avoid unnecessary breaking changes to template tag output, rendered field attributes, or form-processing semantics.
- Treat the Django and Wagtail support matrix in `tox.ini` as a constraint when making changes.
- Preserve backwards compatibility across supported versions unless the task explicitly requires otherwise.

## Testing Expectations

- For model or method changes, add or update focused tests in `tests/test_models.py` or `tests/test_methods.py`.
- For form submission behavior, update `tests/test_form.py` and verify both accepted and ignored submissions.
- For template tag or rendered field changes, update `tests/test_tags.py` with context and rendered HTML assertions.
- Use `tests/testapp/` coverage when the change affects Wagtail page behavior or end-to-end form flow.
- For translation or configuration changes, add focused assertions where practical.
- Run `make lint` or `uv run ruff check .` for Python style checks.
- Run `make format` or `uv run ruff format .` when updating Python formatting.
- Run `make test` or `uv run coverage run manage.py test` for the default suite.
- Use `make tox` or `uv run tox --skip-missing-interpreters` only when matrix coverage is relevant to the task.

## Documentation Rules

- Update `README.md` when package usage, settings, or integration steps change for users.
- Update `docs/developer.md` when local development workflow changes.
- Use `docs/contributing/releasing.md` as the canonical maintainer release runbook.
- Update `CHANGELOG` under `## Unreleased` for every PR. Keep entries short, flat, and user or contributor facing.
- Keep `AGENTS.md` concise and directive; do not turn it into a duplicate contributor guide.

## PR Readiness

- Keep the pull request title and body aligned with the current branch scope.
- Update the PR title whenever the branch scope changes materially and the current title no longer describes the work accurately.
- Update the PR description whenever behavior, tooling, documentation, or test coverage changes materially from the current summary.
- The maintained PR body should cover the behavior change, docs or tooling updates, and verification performed.
- When handling pull request review suggestions that require code changes, commit the fix, push the branch, and update the review reply after the branch reflects the final change set.
- Treat the PR title, PR summary, and `CHANGELOG` entry as required closing steps before the branch is ready.

## Branch Workflow

- Treat `release` as the repository default branch.
- Start all new work from `release`; it tracks the latest changes that are not yet released to PyPI.
- Before making repo-tracked changes, create and switch to a new branch from `release`.
- Do not make routine feature, fix, or documentation changes directly on `release` or `main` unless the task explicitly requires it.
- Treat `main` as the release-preparation branch, not the starting point for routine feature or fix work.
- Target routine merge requests at `release`; follow `docs/contributing/releasing.md` for release-prep work that lands on `main`.

## Change Boundaries

- Do not change version metadata, release tags, release changelog sections, supported-version claims, or migrations unless the task explicitly requires release-prep or compatibility work.
- Keep commit scope narrow and tied to one behavior change.
- Prefer minimal edits that preserve the package's existing API and documented behavior.
17 changes: 17 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

## Unreleased

## [1.3.0] - 2026-04-21

- Add Wagtail 7.3 testing coverage and Django 6.0 coverage for that compatibility line
- Run CI tox jobs via `uvx` so Python 3.10 and 3.11 jobs do not require the Python 3.12+ dev environment
- Document the `release` branch workflow and require merge requests to target `release`
- Require agents to create a new branch from `release` before making repo-tracked changes
- Add agent instructions to keep pull request titles and summaries current and update the changelog on every PR
- Require review-driven code changes to be committed, pushed, and followed by an updated review reply
- Adopt `uv` as the default contributor workflow and lock the local development environment
- Run a reduced SQLite tox subset for `release` pull requests while keeping the full matrix for `main`
- Replace Black, isort, Flake8, and pyupgrade with Ruff for Python formatting and linting
- Add Makefile help output plus dedicated `lint` and `format` targets
- Update contributor and agent documentation for the new development workflow
- Update the honeypot field documentation for the `aria-hidden="true"` accessibility attribute
- Sync the Ruff pre-commit hook version with the locked Ruff release and correct the developer doc Wagtail baseline
- Publish PyPI releases from GitHub Actions with PyPI Trusted Publishing

## [1.2.1] - 2026-02-05

- Add locale support
Expand Down
Loading
Loading