Skip to content

Commit def2afc

Browse files
authored
Merge pull request #48 from nm-packages/codex/release-work
Improve contributor workflow, tooling, and release guidance
2 parents 4e7dce6 + 5256284 commit def2afc

19 files changed

Lines changed: 1532 additions & 241 deletions

.github/workflows/test.yml

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,38 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
test-sqlite:
14+
test-sqlite-release:
15+
if: github.base_ref == 'release'
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
include:
20+
- python: "3.10"
21+
toxenv: py310-django42-wagtail63-sqlite
22+
- python: "3.14"
23+
toxenv: py314-django52-wagtail72-sqlite
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
- name: Set up uv
30+
id: setup-uv
31+
uses: astral-sh/setup-uv@v8.1.0
32+
with:
33+
python-version: ${{ matrix.python }}
34+
enable-cache: true
35+
36+
- name: Sync dependencies
37+
id: sync-dependencies
38+
run: uv sync --locked
39+
40+
- name: Test with tox
41+
id: test-with-tox
42+
run: uv run tox -e ${{ matrix.toxenv }}
43+
44+
test-sqlite-main:
45+
if: github.base_ref == 'main'
1546
runs-on: ubuntu-latest
1647
strategy:
1748
matrix:
@@ -22,26 +53,25 @@ jobs:
2253
- name: Checkout repository
2354
uses: actions/checkout@v3
2455

25-
- name: Set up Python
26-
id: setup-python
27-
uses: actions/setup-python@v4
56+
- name: Set up uv
57+
id: setup-uv
58+
uses: astral-sh/setup-uv@v8.1.0
2859
with:
2960
python-version: ${{ matrix.python }}
61+
enable-cache: true
3062

31-
- name: Install dependencies
32-
id: install-dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
python -m pip install tox tox-gh-actions
63+
- name: Sync dependencies
64+
id: sync-dependencies
65+
run: uv sync --locked
3666

3767
- name: Test with tox
3868
id: test-with-tox
39-
run: |
40-
tox
69+
run: uv run tox
4170
env:
4271
DATABASE: ${{ matrix.database }}
4372

4473
test-postgres:
74+
if: github.base_ref == 'main'
4575
runs-on: ubuntu-latest
4676
strategy:
4777
matrix:
@@ -63,22 +93,20 @@ jobs:
6393
- name: Checkout repository
6494
uses: actions/checkout@v3
6595

66-
- name: Set up Python
67-
id: setup-python
68-
uses: actions/setup-python@v4
96+
- name: Set up uv
97+
id: setup-uv
98+
uses: astral-sh/setup-uv@v8.1.0
6999
with:
70100
python-version: ${{ matrix.python }}
101+
enable-cache: true
71102

72-
- name: Install dependencies
73-
id: install-dependencies
74-
run: |
75-
python -m pip install --upgrade pip
76-
python -m pip install tox tox-gh-actions
103+
- name: Sync dependencies
104+
id: sync-dependencies
105+
run: uv sync --locked
77106

78107
- name: Test with tox
79108
id: test-with-tox
80-
run: |
81-
tox
109+
run: uv run tox
82110
env:
83111
DB_NAME: postgres
84112
DB_USER: postgres
@@ -89,6 +117,7 @@ jobs:
89117

90118

91119
test-mysql:
120+
if: github.base_ref == 'main'
92121
runs-on: ubuntu-latest
93122
strategy:
94123
matrix:
@@ -112,22 +141,20 @@ jobs:
112141
- name: Checkout repository
113142
uses: actions/checkout@v3
114143

115-
- name: Set up Python
116-
id: setup-python
117-
uses: actions/setup-python@v4
144+
- name: Set up uv
145+
id: setup-uv
146+
uses: astral-sh/setup-uv@v8.1.0
118147
with:
119148
python-version: ${{ matrix.python }}
149+
enable-cache: true
120150

121-
- name: Install dependencies
122-
id: install-dependencies
123-
run: |
124-
python -m pip install --upgrade pip
125-
python -m pip install tox tox-gh-actions
151+
- name: Sync dependencies
152+
id: sync-dependencies
153+
run: uv sync --locked
126154

127155
- name: Test with tox
128156
id: test-with-tox
129-
run: |
130-
tox
157+
run: uv run tox
131158
env:
132159
DB_NAME: mysql
133160
DB_USER: root

.pre-commit-config.yaml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
repos:
2-
- repo: https://github.com/pycqa/isort
3-
rev: 7.0.0
2+
- repo: https://github.com/astral-sh/uv-pre-commit
3+
rev: 0.11.3
44
hooks:
5-
- id: isort
6-
- repo: https://github.com/psf/black
7-
rev: 25.11.0
5+
- id: uv-lock
6+
- repo: https://github.com/astral-sh/ruff-pre-commit
7+
rev: v0.15.11
88
hooks:
9-
- id: black
10-
- repo: https://github.com/pycqa/flake8
11-
rev: 7.3.0
12-
hooks:
13-
- id: flake8
9+
- id: ruff-check
10+
args: [--fix]
11+
- id: ruff-format
1412
- repo: https://github.com/jackdewinter/pymarkdown
1513
rev: v0.9.33
1614
hooks:
@@ -19,12 +17,8 @@ repos:
1917
- --disable-rules
2018
- line-length
2119
- scan
22-
- repo: https://github.com/asottile/pyupgrade
23-
rev: v3.21.1
24-
hooks:
25-
- id: pyupgrade
2620
- repo: https://github.com/adamchainz/django-upgrade
2721
rev: "1.29.1" # replace with latest tag on GitHub
2822
hooks:
29-
- id: django-upgrade
30-
args: [--target-version, "5.2"] # Replace with Django version
23+
- id: django-upgrade
24+
args: [--target-version, "5.2"] # Replace with Django version

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

AGENTS.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Agent Conventions
2+
3+
## Purpose
4+
5+
This file guides coding agents working in this repository. Keep it operational and project-specific. Use `README.md` for package usage and `docs/developer.md` for local setup details; do not duplicate those walkthroughs here.
6+
7+
## Workflow Tools
8+
9+
- Use `uv` for contributor and agent workflows by default.
10+
- Use `uv sync` to create or refresh the local environment.
11+
- Use `uv run ...` for project commands instead of bare `python`, `pip`, or globally installed tooling unless the task explicitly requires it.
12+
- Use Ruff for Python formatting and linting by default.
13+
14+
## Repo Map
15+
16+
- `wagtail_honeypot/`: package behavior and public implementation.
17+
- `wagtail_honeypot/models.py`: honeypot settings defaults and form submission logic.
18+
- `wagtail_honeypot/templatetags/honeypot_tags.py`: template tag context and field names.
19+
- `wagtail_honeypot/templates/` and `wagtail_honeypot/static/`: rendered markup and browser-side behavior.
20+
- `wagtail_honeypot/locale/`: translations.
21+
- `tests/`: unit coverage for models, methods, forms, and template tags.
22+
- `tests/testapp/`: minimal Wagtail integration site; use it only when a change needs page-level or form-flow coverage.
23+
24+
## Change Conventions
25+
26+
- Put reusable package behavior in `wagtail_honeypot/`, not in `tests/testapp/`.
27+
- Change `models.py` when adjusting honeypot defaults, settings handling, or form submission decisions.
28+
- Change `templatetags/honeypot_tags.py` and `templates/tags/honeypot_fields.html` when adjusting rendered field names, context, or markup.
29+
- Change `static/css/` or `static/js/` only for browser behavior related to hiding or presenting honeypot fields.
30+
- Update `locale/` only when user-facing strings change.
31+
- Keep `tests/testapp/` focused on integration behavior; do not treat it as a second implementation surface.
32+
33+
## Compatibility Rules
34+
35+
- Preserve existing `HONEYPOT_*` setting names and behavior unless the task explicitly changes support policy.
36+
- Avoid unnecessary breaking changes to template tag output, rendered field attributes, or form-processing semantics.
37+
- Treat the Django and Wagtail support matrix in `tox.ini` as a constraint when making changes.
38+
- Preserve backwards compatibility across supported versions unless the task explicitly requires otherwise.
39+
40+
## Testing Expectations
41+
42+
- For model or method changes, add or update focused tests in `tests/test_models.py` or `tests/test_methods.py`.
43+
- For form submission behavior, update `tests/test_form.py` and verify both accepted and ignored submissions.
44+
- For template tag or rendered field changes, update `tests/test_tags.py` with context and rendered HTML assertions.
45+
- Use `tests/testapp/` coverage when the change affects Wagtail page behavior or end-to-end form flow.
46+
- For translation or configuration changes, add focused assertions where practical.
47+
- Run `make lint` or `uv run ruff check .` for Python style checks.
48+
- Run `make format` or `uv run ruff format .` when updating Python formatting.
49+
- Run `make test` or `uv run coverage run manage.py test` for the default suite.
50+
- Use `make tox` or `uv run tox --skip-missing-interpreters` only when matrix coverage is relevant to the task.
51+
52+
## Documentation Rules
53+
54+
- Update `README.md` when package usage, settings, or integration steps change for users.
55+
- Update `docs/developer.md` when local development workflow changes.
56+
- Update `CHANGELOG` under `## Unreleased` for every PR. Keep entries short, flat, and user or contributor facing.
57+
- Keep `AGENTS.md` concise and directive; do not turn it into a duplicate contributor guide.
58+
59+
## PR Readiness
60+
61+
- Keep the pull request title and body aligned with the current branch scope.
62+
- Update the PR title whenever the branch scope changes materially and the current title no longer describes the work accurately.
63+
- Update the PR description whenever behavior, tooling, documentation, or test coverage changes materially from the current summary.
64+
- The maintained PR body should cover the behavior change, docs or tooling updates, and verification performed.
65+
- 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.
66+
- Treat the PR title, PR summary, and `CHANGELOG` entry as required closing steps before the branch is ready.
67+
68+
## Branch Workflow
69+
70+
- Treat `release` as the repository default branch.
71+
- Start all new work from `release`; it tracks the latest changes that are not yet released to PyPI.
72+
- Treat `main` as the release-preparation branch, not the starting point for routine feature or fix work.
73+
- Target merge requests at `release`.
74+
75+
## Change Boundaries
76+
77+
- Do not change version metadata, supported-version claims, or migrations unless the task requires it.
78+
- Keep commit scope narrow and tied to one behavior change.
79+
- Prefer minimal edits that preserve the package's existing API and documented behavior.

CHANGELOG

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
- Document the `release` branch workflow and require merge requests to target `release`
8+
- Add agent instructions to keep pull request titles and summaries current and update the changelog on every PR
9+
- Require review-driven code changes to be committed, pushed, and followed by an updated review reply
10+
- Adopt `uv` as the default contributor workflow and lock the local development environment
11+
- Run a reduced SQLite tox subset for `release` pull requests while keeping the full matrix for `main`
12+
- Replace Black, isort, Flake8, and pyupgrade with Ruff for Python formatting and linting
13+
- Add Makefile help output plus dedicated `lint` and `format` targets
14+
- Update contributor and agent documentation for the new development workflow
15+
- Update the honeypot field documentation for the `aria-hidden="true"` accessibility attribute
16+
- Sync the Ruff pre-commit hook version with the locked Ruff release and correct the developer doc Wagtail baseline
17+
718
## [1.2.1] - 2026-02-05
819

920
- Add locale support

Makefile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
1+
.DEFAULT_GOAL := help
2+
3+
.PHONY: help sync lint format run mail test tox migrate superuser
4+
5+
help:
6+
@printf "Available targets:\n"
7+
@printf " make sync Sync the uv-managed development environment\n"
8+
@printf " make lint Run Ruff lint checks\n"
9+
@printf " make format Run Ruff fixes and formatting\n"
10+
@printf " make run Start the local Django development server\n"
11+
@printf " make mail Start Mailhog for local email testing\n"
12+
@printf " make test Run the default Django test suite with coverage\n"
13+
@printf " make tox Run the supported compatibility matrix\n"
14+
@printf " make migrate Apply local database migrations\n"
15+
@printf " make superuser Create the default local admin user\n"
16+
17+
sync:
18+
uv sync
19+
20+
lint:
21+
uv run ruff check .
22+
23+
format:
24+
uv run ruff check . --fix
25+
uv run ruff format .
26+
127
run:
2-
python manage.py runserver 0:8000
28+
uv run python manage.py runserver 0:8000
329

430
mail:
531
docker run -p 8025:8025 -p 1025:1025 mailhog/mailhog
632

733
test:
8-
coverage run manage.py test && coverage report
34+
uv run coverage run manage.py test
35+
uv run coverage report
936

1037
tox:
11-
tox --skip-missing-interpreters
38+
uv run tox --skip-missing-interpreters
1239

1340
migrate:
14-
python manage.py migrate
41+
uv run python manage.py migrate
1542

1643
superuser:
17-
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', 'admin@admin.com', 'changeme')" | python manage.py shell
44+
@echo "from django.contrib.auth import get_user_model; get_user_model().objects.create_superuser('admin', 'admin@admin.com', 'changeme')" | uv run python manage.py shell

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ the field could be seen for a flash while the page loads -->
162162

163163
The field should be visibly hidden and not be available to receive any value from a site visitor.
164164

165-
> When rendered, the fields will have the HTML attributes `tabindex="-1" autocomplete="off"` to prevent a site visitor from using the tab key to move to the field and disable any autocomplete browser functions.
165+
> When rendered, the fields will have the HTML attributes `tabindex="-1" autocomplete="off" aria-hidden="true"` to keep them out of normal keyboard navigation, disable browser autocomplete, and hide them from assistive technology.
166166
167167
## Developer Documentation
168168

0 commit comments

Comments
 (0)