$npx skillfedfor your agent

django-zen-queries

Explicit control over query execution in Django applications.

With conditionsPyPI Quality AssuranceReleased Jul 2021155.8K downloads / moBSDPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — django_zen_queries-2.1.0-py3-none-any.whl
v2.1.0 · released 2021-07-27 · Python >=3.6 · 1 runtime deps: Django

Yes, if you develop Django applications and want to catch N+1 and other implicit query problems during development. The package is lightweight, actively maintained, and widely used. Install it in development environments to enforce explicit query boundaries; the overhead is negligible for a debugging tool. Most teams use it as a development-time safety net rather than in production.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Django and Python 3.6 or later.
  • Low friction install with a single runtime dependency on Django.
  • Actively maintained with recent commits and steady adoption.

License · maintenance · safety

BSD (permissive) — BSD license is permissive and poses no restrictions on commercial or private use.

last release 2021-07-27 (1844 days) · last repo commit 2026-08-04 · 388 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 155,817 downloads/mo, #10,799 on PyPI

Verify before relying

pip install django-zen-queries

from django_zen_queries import queries_disabled, fetch

def menu(request):
    pizzas = fetch(Pizza.objects.all())
    with queries_disabled():
        return render(request, 'menu.html', {'pizzas': pizzas})
  • Whether the package works with Django versions released after 3.1 (last tested version in description).
  • Performance overhead of the query-blocking mechanism in production environments.
  • Current compatibility with modern Django and Python versions beyond those mentioned in the description.
Same gist for agents: .md · .json

What it is and what it does

django-zen-queries is a Django debugging and design tool that makes database query execution explicit rather than implicit. It provides context managers and decorators that prevent code from running queries unless explicitly allowed, forcing developers to think about when and where data is fetched versus rendered. The package addresses a fundamental Django ORM weakness: lazy evaluation hides query execution, making it easy to accidentally trigger the N+1 problem when templates or serializers access related data without proper prefetching.

The package includes a queries_disabled context manager and decorator, a fetch utility to force queryset evaluation, and integration helpers for Django templates and Django REST Framework serializers. It does not optimize queries itself—instead, it fails loudly when queries run where they shouldn't, pushing developers to design code that separates data fetching from data rendering.

Use it for

  • Wrap template rendering in views to catch N+1 query problems before production.
  • Decorate serializer methods to prevent REST Framework endpoints from unexpectedly querying during serialization.
  • Enforce architectural boundaries where certain functions should never trigger database access.
  • Debug performance regressions by identifying which code paths execute unexpected queries.
  • Use as a development-time safety net to catch query problems introduced by template or serializer changes.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you develop Django applications and want to catch N+1 and other implicit query problems during development.

The package is lightweight, actively maintained, and widely used. Install it in development environments to enforce explicit query boundaries; the overhead is negligible for a debugging tool. Most teams use it as a development-time safety net rather than in production.

Install

django-zen-queries on PyPI

Before you install

Low friction install with a single runtime dependency on Django. Actively maintained with recent commits and steady adoption.

Requires Django and Python 3.6 or later.

License in practice

BSD license is permissive and poses no restrictions on commercial or private use.

Quickstart

pip install django-zen-queries

from django_zen_queries import queries_disabled, fetch

def menu(request):
    pizzas = fetch(Pizza.objects.all())
    with queries_disabled():
        return render(request, 'menu.html', {'pizzas': pizzas})

Verify before relying

  • Whether the package works with Django versions released after 3.1 (last tested version in description).
  • Performance overhead of the query-blocking mechanism in production environments.
  • Current compatibility with modern Django and Python versions beyond those mentioned in the description.

Package facts

LicenseBSD permissive
Python supportSupports the current Python release >=3.6
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
Django
MaintenanceActively maintained 1,844 days since the last release
Last repo commit
First released
Downloads155,817 / month, #10,799 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: django_zen_queries-2.1.0-py3-none-any.whl

Tags

Capabilities
django query controlprevent implicit database queriesdjango n+1 problem detectionexplicit query execution djangodjango performance debuggingquery execution context managerdjango lazy evaluation control
Topics
django-performancequery-debuggingorm-control

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 control”

  • django-zen-queriesPrevents unintended database queries in Django views and serializers…
  • django-pgactivityProvides Django management commands and utilities to view, filter,…
  • drf-flex-fieldsAdds dynamic field expansion and sparse field selection to Django…

Give your agent the search over MCP, or paste the wish link into any chat.

More Quality Assurance packages

coverage Worth it
PyPI · Testing · released Aug 2026

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.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
ruff Worth it
PyPI · Python Modules · released Aug 2026

Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.

MITcompiled wheel · 3.7+
316.1Mdownloads / mo
pexpect With conditions
PyPI · Software Development · released Nov 2023

Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.

ISCpure Pythonaging
200.8Mdownloads / mo
black Worth it
PyPI · Python Modules · released May 2026

Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.

MITpure Python · 3.10+
179.9Mdownloads / mo
pytest-xdist Worth it
PyPI · Utilities · released Jul 2025

pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.

Install it if your test suite takes long enough that parallelization would save meaningful time.

MITpure Python · 3.9+
177.1Mdownloads / mo
cfn-lint Worth it
PyPI · Quality Assurance · released Aug 2026

Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.

Install it if you work with CloudFormation templates.

MIT-0pure Python
114.9Mdownloads / mo

See also django-pgactivity · drf-access-policy · djangorestframework-role-filters · drf-dynamic-fields · django-mock-queries · django-query-builder · django-ordered-model · adrf · django-pg-returning · django-read-only