djangorestframework-types
Type stubs for Django Rest Framework
What it is and what it does
This package provides type stubs for Django Rest Framework, the popular REST API toolkit for Django. Type stubs are interface definitions that allow static type checkers like mypy and pyright to understand the types of Django Rest Framework's classes and functions, enabling developers to catch type errors during development rather than at runtime.
The package was forked from djangorestframework-stubs specifically to remove the mypy plugin dependency, which could crash when Django configuration issues arose. By providing pure stubs instead, it works with multiple type checkers—not just mypy—and avoids the fragility of plugin-based type checking. It has a single runtime dependency on typing_extensions and supports Python 3.8 through 3.12.
Use it for:
- Add type checking to Django Rest Framework projects using mypy or pyright without installing a mypy plugin
- Catch serializer, viewset, and API endpoint type errors during development before deployment
- Enable IDE autocomplete and type hints for Django Rest Framework classes and methods
- Migrate from an older type-stub package to a plugin-free alternative that works with multiple type checkers
- Ensure type safety in REST API views and serializers across a team's codebase
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type stubs for Django Rest Framework, enabling static type checking with mypy, pyright, and other type checkers without requiring a mypy plugin.
Yes, if you use Django Rest Framework and want static type checking. The low install friction, permissive license, and multi-checker support make it practical. However, the aging maintenance status (673 days since last release) means you should verify that type coverage matches your Django Rest Framework version before committing to it in a new project.
Install
djangorestframework-types on PyPI
pip
pip install djangorestframework-typesuv
uv add djangorestframework-typespoetry
poetry add djangorestframework-typesInstalling djangorestframework-types
Before you install
Low install friction with a single lightweight dependency (typing_extensions). Maintenance status is aging—last release was 673 days ago, though the repository remains active.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install djangorestframework-types
import typing_extensions
# Type stubs are now available for Django Rest Framework type checking
Requires Python 3.8 or later; intended for use with a static type checker like mypy or pyright
Verify before relying
- Whether type coverage is comprehensive across all Django Rest Framework versions and APIs
- Compatibility with the latest Django Rest Framework releases and whether stubs are kept in sync
- Whether pyright and other non-mypy checkers work as well as claimed compared to the original version
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | aging — 673 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 379,713/month — #7,109 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: djangorestframework_types-0.9.0-py3-none-any.whl
Keywords: django, djangorestframework, types, mypy, stubs
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
django-typesProvides type stubs for Django to enable static…
permissive · top 5,000 on PyPI
djangorestframework-stubsProvides PEP-484 type stubs for Django REST…
permissive · top 5,000 on PyPI
celery-typesProvides type stubs for Celery and related…
permissive · top 5,000 on PyPI
django-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
django-stubs-extProvides runtime monkey-patching extensions for…
permissive · top 5,000 on PyPI
pandas-stubsProvides type stubs for pandas, enabling static…
permissive · top 1,000 on PyPI
types-mypy-extensionsProvides type stubs for mypy-extensions,…
permissive · top 15,000 on PyPI
types-boltonsProvides type stubs for the boltons library,…
permissive · top 15,000 on PyPI
types-cffiProvides type stubs for the cffi package,…
permissive · top 5,000 on PyPI
msgpack-typesProvides type stubs for msgpack to enable…
permissive · top 15,000 on PyPI