django-perf-rec
Keep detailed records of the performance of your Django code.
Decision gist · record as of 2026-08-14
Yes, if you maintain a Django test suite and want to detect performance regressions automatically. The low install friction, permissive license, and active maintenance make it a practical choice. Note that the author recommends inline-snapshot-django as a faster alternative for new projects, so consider whether that better fits your needs; django-perf-rec remains suitable for existing codebases and will continue to receive maintenance.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django 4.2 to 6.0 and Python 3.9 or later; intended for use within Django test cases.
- Low friction install with three stable runtime dependencies (django, pyyaml, sqlparse).
- Package is actively maintained and in use, though the author notes it is now in maintenance mode with a newer alternative (inline-snapshot-django) available.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
last release 2025-09-18 (330 days) · last repo commit 2026-08-13 · 356 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 100,108 downloads/mo, #13,002 on PyPI
Alternatives
Verify before relying
pip install django-perf-rec
import django_perf_rec
with django_perf_rec.record():
self.client.get("/")- Performance overhead of recording and fingerprinting operations during test runs.
- Compatibility with test runners other than Django's default (pytest support mentioned but not detailed).
- How YAML file diffs are presented and whether they integrate with CI/CD systems.
What it is and what it does
django-perf-rec is a test instrumentation tool that records all database queries and cache operations executed within a test context, storing them in a YAML file for comparison on subsequent runs. When a test runs again, the new operations are compared against the stored record; if they differ, the test fails, alerting you to performance regressions. The tool fingerprints queries and cache keys by replacing variable data (like primary keys) with `#` and truncating long strings with `...`, so that incidental changes like new columns or different random data don't cause spurious test failures.
It wraps Django's lower-level `assertNumQueries` with a much richer view of what actually happened during test execution. You use it as a context manager around the code you want to profile, and it automatically determines the test name and file path for storing records. The package also provides hooks to selectively capture tracebacks for debugging specific operations and to filter which operations get recorded, useful for hiding test-only queries that would be handled differently in production.
Use it for
- Catch unintended N+1 queries introduced by code changes before they reach production.
- Document expected database and cache behavior for a test as a regression baseline.
- Debug which code paths trigger specific database queries using optional traceback capture.
- Exclude test-only database operations from performance records using operation filters.
- Enforce consistent query patterns across a Django test suite without manual assertion counts.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you maintain a Django test suite and want to detect performance regressions automatically.
The low install friction, permissive license, and active maintenance make it a practical choice. Note that the author recommends inline-snapshot-django as a faster alternative for new projects, so consider whether that better fits your needs; django-perf-rec remains suitable for existing codebases and will continue to receive maintenance.
Install
django-perf-rec on PyPI
Before you install
Low friction install with three stable runtime dependencies (django, pyyaml, sqlparse). Package is actively maintained and in use, though the author notes it is now in maintenance mode with a newer alternative (inline-snapshot-django) available.
Requires Django 4.2 to 6.0 and Python 3.9 or later; intended for use within Django test cases.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install django-perf-rec
import django_perf_rec
with django_perf_rec.record():
self.client.get("/")
Verify before relying
- Performance overhead of recording and fingerprinting operations during test runs.
- Compatibility with test runners other than Django's default (pytest support mentioned but not detailed).
- How YAML file diffs are presented and whether they integrate with CI/CD systems.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesdjangopyyamlsqlparse |
| Maintenance | Actively maintained 330 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 100,108 / month, #13,002 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 6 - MatureFramework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTyping :: Typed |
Evidence: django_perf_rec-4.31.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “django query performance testing”
- django-perf-recRecords and compares Django database queries and cache operations in…
- django-zealDetects N+1 query problems in Django applications by monitoring…
- django-queryinspectDjango middleware that logs and reports SQL query statistics for each…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also django-dirtyfields · django-querycount · django-zeal · django-mock-queries · django-queryinspect · django-cacheops · betamax · django-upgrade · django-cachalot · records