django-types
Type stubs for Django
Decision gist · record as of 2026-08-14
Yes. django-types is actively maintained, has no known vulnerabilities, low install friction, and is essential for any Django project using static type checking. The MIT license is permissive. Install it if you use type checkers with Django; it's a standard practice for modern Django development.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- QuerySet and Manager generics do not support subscripting at runtime; use string annotations or django_stubs_ext.monkeypatch() as a workaround.
- Low install friction with a single runtime dependency (types-psycopg2).
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-04-22 (114 days) · last repo commit 2026-06-23 · 341 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,069,134 downloads/mo, #4,409 on PyPI
Alternatives
Verify before relying
pip install django-types
# In your Django model:
from typing import Optional
from django.db import models
class User(models.Model):
team_id: Optional[int]
team = models.ForeignKey('Team', null=True, on_delete=models.SET_NULL)- Whether type coverage is complete for all Django ORM features and edge cases
- Performance impact of type checking with these stubs on typical Django projects
What it is and what it does
django-types is a type stub package that adds static type information for Django, enabling type checkers like mypy and pyright to understand Django's API. It was forked from django-stubs specifically to remove the mypy plugin dependency, which means it works with multiple type checkers and avoids crashes caused by Django configuration issues.
The package helps developers annotate Django models, querysets, managers, and HTTP request objects with proper types. It includes guidance for common patterns like foreign key relationships, related managers, and authenticated request handlers. Since Django's ORM classes don't support runtime subscripting (e.g., QuerySet[MyModel]), the stubs document workarounds using string annotations or a companion monkeypatch utility.
Use it for
- Add type hints to Django ORM models so foreign keys and related managers are properly typed for IDE autocomplete and type checking
- Enable pyright or other non-mypy type checkers to validate Django code without plugin crashes
- Annotate view functions with typed HttpRequest subclasses to enforce authentication requirements at the type level
- Catch type errors in Django querysets and manager calls during development rather than at runtime
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
django-types is actively maintained, has no known vulnerabilities, low install friction, and is essential for any Django project using static type checking. The MIT license is permissive. Install it if you use type checkers with Django; it's a standard practice for modern Django development.
Install
django-types on PyPI
Before you install
Low install friction with a single runtime dependency (types-psycopg2). Actively maintained with recent releases; last commit 2026-06-23 and latest release 2026-04-22.
Requires Python 3.10 or later. QuerySet and Manager generics do not support subscripting at runtime; use string annotations or django_stubs_ext.monkeypatch() as a workaround.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install django-types
# In your Django model:
from typing import Optional
from django.db import models
class User(models.Model):
team_id: Optional[int]
team = models.ForeignKey('Team', null=True, on_delete=models.SET_NULL)
Verify before relying
- Whether type coverage is complete for all Django ORM features and edge cases
- Performance impact of type checking with these stubs on typical Django projects
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetypes-psycopg2 |
| Maintenance | Actively maintained 114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,069,134 / month, #4,409 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: django_types-0.24.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 stubs”
- django-typesProvides type stubs for Django to enable static type checking with…
- djangorestframework-typesProvides type stubs for Django Rest Framework, enabling static type…
- django-filter-stubsProvides PEP-484 type stubs for django-filter to enable 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 · djangorestframework-types · msgpack-types · pytest-mypy-plugins · django-stubs-ext · celery-types · pyre-extensions · types-SQLAlchemy · tightwrap · types-Flask-SQLAlchemy