Deterministic visual regression testing CLI for Django platforms.
Project description
django-vrt
django-vrt (djvrt) is a Python-first visual regression testing package for Django platforms.
It is built for large, fast-moving UI systems where you need deterministic screenshots, repeatable CI, and safe baseline promotion.
Core value
- Deterministic lockfile matrix (
djvrt.lock.json) - Reproducible baseline and check workflows
- Built-in screenshot diffing and CI reports
- Interactive HTML review UI with filter/sort and image comparison modes
- Django route discovery from sitemap and URLConf
- Data and model seeding hooks for stable UI state
- Package-first extension model for complex projects
Install
Consumer project:
uv add django-vrt
uv run playwright install chromium
Package development:
uv sync --extra dev
uv run playwright install chromium
Quickstart
uv run djvrt init
uv run djvrt discover --settings your_project.settings
uv run djvrt lock
uv run djvrt baseline
uv run djvrt check
Artifacts are stored in .djvrt/ by default.
Getting Started Checklist
- Install package + Chromium.
- Generate config/scenarios with
djvrt init. - Discover routes (or provide deterministic seeded scenarios).
- Build
djvrt.lock.jsonwithdjvrt lock. - Capture baseline once with
djvrt baseline. - Gate PRs using
djvrt check.
CLI commands
djvrt init: createdjvrt.tomland starter scenariosdjvrt discover: discover URL scenariosdjvrt lock: compile deterministic matrix lockfiledjvrt baseline: capture baseline imagesdjvrt check: compare current screenshots against baselinedjvrt report: regenerate HTML and JUnit reports fromsummary.jsondjvrt approve: promote runactual/images to baselinedjvrt auth-state: capture Playwrightstorage_stateJSONpython -m djvrt.django_seed_cli: run hook-driven project seeding
Tip: add --open to djvrt baseline, djvrt check, or djvrt report to auto-open the generated HTML report.
Package-first integration model
Use django-vrt as the shared engine. Keep consumer-repo code limited to small extension modules:
- seeder class (
module:Class) implementingBaseDjangoVRTSeeder - optional setup hook (
module:function) to calldjango.setup() - optional options builder (
module:function) for project-specific seed options
This keeps custom logic minimal and avoids per-project forks of VRT infrastructure.
Determinism checklist
- Commit
uv.lock - Commit
djvrt.lock.jsonfor the baseline contract - Pin Python version and Playwright version
- Install Chromium in CI (
playwright install chromium) - Run on a stable OS image with controlled fonts
- Prefer deterministic data hooks (
get_or_create, fixed identifiers) - Set
runtime.js_random_seedindjvrt.tomlwhen frontend code usesMath.random() - Set
runtime.always_write_diff_images = trueif you need diff overlays for passed scenarios
Deployment to PyPI
django-vrt is automatically published to PyPI via GitHub Actions. There are three ways to trigger a release:
1. GitHub Release (Recommended)
Create a new release through the GitHub UI:
- Go to Releases → "Create a new release"
- Set tag (e.g.,
v0.2.0) and title - Click "Publish release"
- The workflow automatically builds and publishes to PyPI
2. Version Tag Push
Push a version tag directly:
git tag v0.2.0
git push origin v0.2.0
This triggers the build and publish automatically.
3. Manual Workflow Trigger
Run the publish workflow manually from GitHub:
- Go to Actions → "publish" workflow
- Click "Run workflow" → "Run workflow"
- The current
mainbranch code is built and published
Pre-release checklist
Before releasing:
- Update version in
pyproject.toml(version = "x.y.z") - Update
CHANGELOG.mdor release notes (if applicable) - Ensure all tests pass:
uv sync --extra dev && uv run pytest - Verify linting:
uv run ruff check . - Commit and push changes to
main
How it works
The publish workflow (.github/workflows/publish.yml) does the following:
- Build stage: Installs dependencies, builds wheel and source distributions, validates metadata
- Publish stage: Downloads artifacts and publishes to PyPI using OIDC authentication (no API key needed)
The workflow uses GitHub's trusted publisher model for PyPI authentication. No secrets need to be configured—PyPI automatically trusts builds from this repository.
Documentation map
/docs/quickstart.md/docs/configuration.md/docs/django-seeding.md/docs/ci.md/docs/local-playbook.md
Examples
- CI workflow:
examples/github-actions.yml - Seeder adapter template:
examples/django_seed_adapter.py
Sponsors
This project is developed with support from Mabyduck — Evaluating AI-generated audio, images, and videos with human feedback.
Special thanks to Lucas Theis (LinkedIn) for enabling this work during business hours. Project maintained by William Blackie (LinkedIn).
Learn more: Mabyduck on GitHub | Mabyduck on LinkedIn
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_vrt-0.0.1.tar.gz.
File metadata
- Download URL: django_vrt-0.0.1.tar.gz
- Upload date:
- Size: 136.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1fa42b154dc7a1dade6f512adfe68b46cebe3c973991cf5d982b26b19f76e70
|
|
| MD5 |
3f2e6eeedcc04ea0189c5b303484edc7
|
|
| BLAKE2b-256 |
9d67618c096efaed3c9e007cee3f1520236a536e0943ae31ade286c877ab2a80
|
Provenance
The following attestation bundles were made for django_vrt-0.0.1.tar.gz:
Publisher:
publish.yml on William-Blackie/django-vrt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_vrt-0.0.1.tar.gz -
Subject digest:
b1fa42b154dc7a1dade6f512adfe68b46cebe3c973991cf5d982b26b19f76e70 - Sigstore transparency entry: 982692474
- Sigstore integration time:
-
Permalink:
William-Blackie/django-vrt@3ba3ef6496707c92878152204caa6a231eb2c319 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/William-Blackie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ba3ef6496707c92878152204caa6a231eb2c319 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_vrt-0.0.1-py3-none-any.whl.
File metadata
- Download URL: django_vrt-0.0.1-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
421a0ba71b076368703023d8619488aabf0d438e2736c4ebc11e9ec172eab159
|
|
| MD5 |
1ea67e8a76c6572ce675e9e33ddf300f
|
|
| BLAKE2b-256 |
a0f8f4a4f341e2cf840676c1e19588d4ea646abee572989359f90e7effa769c3
|
Provenance
The following attestation bundles were made for django_vrt-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on William-Blackie/django-vrt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_vrt-0.0.1-py3-none-any.whl -
Subject digest:
421a0ba71b076368703023d8619488aabf0d438e2736c4ebc11e9ec172eab159 - Sigstore transparency entry: 982692515
- Sigstore integration time:
-
Permalink:
William-Blackie/django-vrt@3ba3ef6496707c92878152204caa6a231eb2c319 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/William-Blackie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ba3ef6496707c92878152204caa6a231eb2c319 -
Trigger Event:
push
-
Statement type: