django-stubs-ext
Monkey-patching and extensions for django-stubs
Decision gist · record as of 2026-08-14
Yes. If you use django-stubs for type checking, this package is essential—it's a lightweight, actively maintained companion that enables the type hints django-stubs provides to work correctly at runtime. Install it alongside django-stubs and call monkeypatch() once in your settings. No known vulnerabilities, permissive license, and minimal dependencies make it a safe addition.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later; call monkeypatch() once in your Django settings, not repeatedly.
- Low install friction with only 2 runtime dependencies (django and typing-extensions).
- Active maintenance with a release 2 days old.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
last release 2026-08-12 (2 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 12,136,688 downloads/mo, #1,339 on PyPI
Alternatives
Verify before relying
pip install django-stubs-ext
import django_stubs_ext
django_stubs_ext.monkeypatch()- Whether the __class_getitem__ implementation handles all Django versions supported or only a subset.
- Performance impact of the monkey-patching at application startup.
What it is and what it does
django-stubs-ext is a companion package to django-stubs that applies runtime monkey-patching to Django classes to support generic type hints. Django's built-in classes don't define the `__class_getitem__` method needed for proper typing with generic syntax, so this package adds that method at runtime. The package is designed to be called once during Django application initialization, typically in settings, and intelligently patches only the features needed for your specific Django version.
The package exists because django-stubs itself is a type-stub-only library that can't perform runtime modifications. By splitting the runtime extensions into a separate package, applications using django-stubs avoid needing mypy as a production dependency. The monkey-patching is minimal and safe—it adds a `__class_getitem__` method that returns the class itself, enabling type checkers to understand generic Django class usage without breaking runtime behavior.
Use it for
- Enable type hints for Django generic classes in projects using django-stubs without mypy as a runtime dependency.
- Support proper typing of Django QuerySet and Manager generics in IDE autocomplete and type checking.
- Ensure compatibility across multiple Django versions by applying version-specific patches at runtime.
- Integrate type safety into existing Django projects that rely on django-stubs for static type checking.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
If you use django-stubs for type checking, this package is essential—it's a lightweight, actively maintained companion that enables the type hints django-stubs provides to work correctly at runtime. Install it alongside django-stubs and call monkeypatch() once in your settings. No known vulnerabilities, permissive license, and minimal dependencies make it a safe addition.
Install
django-stubs-ext on PyPI
Before you install
Low install friction with only 2 runtime dependencies (django and typing-extensions). Active maintenance with a release 2 days old.
Requires Python 3.11 or later; call monkeypatch() once in your Django settings, not repeatedly.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
pip install django-stubs-ext
import django_stubs_ext
django_stubs_ext.monkeypatch()
Verify before relying
- Whether the __class_getitem__ implementation handles all Django versions supported or only a subset.
- Performance impact of the monkey-patching at application startup.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesdjangotyping-extensions |
| Maintenance | Actively maintained 2 days since the last release |
| First released | |
| Downloads | 12,136,688 / month, #1,339 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Framework :: DjangoFramework :: Django :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Operating System :: OS IndependentProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed |
Evidence: django_stubs_ext-6.1.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 type hints runtime”
- django-stubs-extProvides runtime monkey-patching extensions for django-stubs to…
- django-typesProvides type stubs for Django to enable static type checking with…
- django-stubsProvides type stubs and a mypy plugin to enable precise static type…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also django-stubs · django-types · djangorestframework-types · celery-types · django-htmx · patchy · grpc-stubs · forbiddenfruit · typish · pytest-stub