Registry / type-stubs / django-stubs-ext

django-stubs-ext

JSON →
library6.1.0pypypi✓ verified 25d ago

django-stubs-ext is a Python library that provides essential monkey-patching and extensions for `django-stubs`, significantly enhancing static type checking for Django projects using Mypy. It ensures better compatibility and stub coverage for advanced Django features and commonly used patterns. The library is actively maintained with frequent updates, often aligning with new Django and Mypy releases, and is currently at version 6.0.2.

pip install django-stubs-ext
INSTALL
IMPORT
SIG · DJANGO-STUBS-EXT
D
django-stubs-ext
type-stubspythonv6.1.0
Install
3.6s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.0.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.6s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

django_stubs_ext.mypy_plugin
Add 'django_stubs_ext.mypy_plugin' to `mypy_plugins` in `mypy.ini`.
This library primarily functions as a Mypy plugin, rather than through direct Python symbol imports into user code.

To enable `django-stubs-ext`, add its plugin entry to your `mypy.ini` (or equivalent Mypy configuration file) under the `[mypy]` section. This activates the extensions and monkey-patches provided by the library.

[mypy] plugins = django_stubs_ext.mypy_plugin
Debug
Known issues
breakingVersion 6.0.0 introduced significant changes, including dropping support for older Django versions and primarily targeting Django 6.0. Ensure your Django project is compatible.
fix
Upgrade your Django project to a compatible version (Django 6.0 or newer). Consider pinning `django-stubs-ext` to `~=5.2` if you are on an older Django version.
affects: >=6.0.0
breaking`django-stubs-ext` versions 6.0.x are designed for `mypy@1.20` and newer. Using older Mypy versions might lead to compatibility issues or incorrect type checking results.
fix
Ensure your Mypy installation is updated to version 1.20 or newer (`pip install --upgrade mypy`).
affects: >=6.0.0
gotchaVersion 6.0.0 of `django-stubs-ext` contained a known crash bug when checking `QuerySet.order_by()` with abstract models. This issue was resolved in subsequent patch releases.
fix
Upgrade to `django-stubs-ext` version 6.0.1 or newer (`pip install --upgrade django-stubs-ext`).
affects: 6.0.0
gotchaFor `django-stubs-ext` to function correctly, it must be used in conjunction with `django-stubs`. Ensure both libraries are installed and your Mypy configuration points to the `django_stubs_ext.mypy_plugin`.
fix
Install `django-stubs` (`pip install django-stubs`) and correctly configure `mypy.ini` as described in the quickstart.
affects: all
gotchaThe `NameError: name 'mypy' is not defined` indicates that a Mypy configuration file (e.g., `mypy.ini`) is being executed directly as a Python script. Mypy configuration files are not Python scripts and should not be run with `python <config_file.ini>`. Instead, invoke Mypy using the `mypy` command (e.g., `mypy your_project/`). Mypy will automatically discover and use configuration files like `mypy.ini` in your project root.
fix
Ensure you are invoking Mypy correctly via the `mypy` command, and not attempting to execute `mypy.ini` or similar configuration files as Python scripts. Refer to the Mypy and `django-stubs` quickstart guides for correct setup instructions.
affects: all
Upgrade
Version history
6.1.0latest on PyPI · released Aug 12, 2026
Audit
Dependencies
django-stubsrequiredProvides the core Django type stubs that this library extends.
mypyrequiredRequired for static type checking; this library provides a mypy plugin.
Agent activity
33 hits · last 30 days
node
28
OpenAI (training)
1
Resources
django-stubs-ext — pip install django-stubs-ext · libregistry