--- id: django-zeal version: "2.2.2" license: Copyright 2016 Joshua Carp Copyright 2024 Tao Bojlén Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) license_treatment: unclear maintenance: active --- # django-zeal — Detect N+1s in your Django app License: unclear · Maintenance: active · Downloads: 133.8K/mo ## What it is and what it does django-zeal is a Django development tool that catches N+1 query problems—situations where the same database query runs multiple times when it should run once. It monitors queries during web requests, Celery tasks, and test runs, detecting N+1s caused by missing prefetches or misuse of .defer(), .only(), and .get() methods. The tool integrates via Django middleware and signals, raising errors or logging warnings when problems are found. It works by tracking which queries execute and how many times, with a configurable threshold for what counts as an N+1. You can allowlist specific model/field combinations, temporarily ignore sections of code, or listen to Django signals to handle detections globally. The package has no runtime dependencies and adds minimal overhead, making it practical for continuous use in development and test suites. Use it for: - Catch N+1 query bugs during Django test runs before code review or deployment - Monitor Celery background tasks for database query inefficiencies using signal hooks - Identify missing prefetch_related() calls in view code with precise file and line numbers - Allow-list known false positives or intentional query patterns to keep test suites clean - Debug query performance regressions by enabling full call stacks with ZEAL_SHOW_ALL_CALLERS ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Detects N+1 query problems in Django applications by monitoring database queries during web requests, Celery tasks, and tests, with configurable thresholds and allowlisting. Yes. django-zeal is a low-friction, actively maintained tool with no dependencies that solves a real Django performance problem. Install it in development and test environments to catch N+1 queries early. The MIT license is clear, and the overhead is acceptable for non-production use. Not suitable for production deployment. ## Install pip install django-zeal uv add django-zeal poetry add django-zeal ## Installing django-zeal Before you install: Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 21 days ago. Designed to run only in development and test environments with documented 3-5% overhead. License in practice: MIT license (clear permissive terms). Includes attribution to original nplusone author Joshua Carp and current maintainer Tao Bojlén. Quickstart: pip install django-zeal # In Django settings.py (development only): if DEBUG: INSTALLED_APPS.append("zeal") MIDDLEWARE.append("zeal.middleware.zeal_middleware") # Or with a test framework: from zeal import zeal_context with zeal_context(): # your code here pass Requires Django and Python 3.9 or later. Intended for development and test environments only; not for production use. Verify before relying: - Whether the package detects all forms of N+1 queries or only the specific patterns mentioned (missing prefetches, .defer(), .only(), .get()) - Compatibility with specific Django versions (not specified in fact sheet) - Current test coverage and stability metrics beyond 'well-tested' claim ## Package facts - License: Copyright 2016 Joshua Carp Copyright 2024 Tao Bojlén Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 133.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django n+1 query detection, catch duplicate database queries, django orm performance testing, prefetch missing detection, django query monitoring, database query optimization tool, django test performance checker, django-orm, performance-testing, query-optimization [View on SkillFed](https://skillfed.io/packages/django-zeal) · [View on PyPI](https://pypi.org/project/django-zeal/)