{"id":1458,"library":"django-stubs-ext","title":"Django Stubs Extensions","description":"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.","status":"active","version":"6.0.2","language":"en","source_language":"en","source_url":"https://github.com/typeddjango/django-stubs-ext","tags":["django","mypy","type checking","stubs","typing"],"install":[{"cmd":"pip install django-stubs-ext","lang":"bash","label":"Install `django-stubs-ext`"}],"dependencies":[{"reason":"Provides the core Django type stubs that this library extends.","package":"django-stubs","optional":false},{"reason":"Required for static type checking; this library provides a mypy plugin.","package":"mypy","optional":false}],"imports":[{"note":"This library primarily functions as a Mypy plugin, rather than through direct Python symbol imports into user code.","symbol":"django_stubs_ext.mypy_plugin","correct":"Add 'django_stubs_ext.mypy_plugin' to `mypy_plugins` in `mypy.ini`."}],"quickstart":{"code":"[mypy]\nplugins = django_stubs_ext.mypy_plugin","lang":"ini","description":"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."},"warnings":[{"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.","message":"Version 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.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Ensure your Mypy installation is updated to version 1.20 or newer (`pip install --upgrade mypy`).","message":"`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.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade to `django-stubs-ext` version 6.0.1 or newer (`pip install --upgrade django-stubs-ext`).","message":"Version 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.","severity":"gotcha","affected_versions":"6.0.0"},{"fix":"Install `django-stubs` (`pip install django-stubs`) and correctly configure `mypy.ini` as described in the quickstart.","message":"For `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`.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}