Skip to main content
mypy logo

pep484 stubs for Django REST framework

test Checked with mypy Gitter StackOverflow

Mypy stubs for Django REST Framework. Supports Python 3.11 and up.

Installation

pip install djangorestframework-stubs[compatible-mypy]

To make mypy aware of the plugin, you need to add

[mypy]
plugins =
    mypy_drf_plugin.main

in your mypy.ini file.

FAQ

Model instance is inferred as Any instead of my Model class

When subclassing ModelSerializer, add a type argument to type-hint the related model class, for example:

class MyModelSerializer(serializers.ModelSerializer[MyModel]):
    class Meta:
        model = MyModel
        fields = ("id", "example")

Which means that methods where the model is being passed around will know the actual type of the model instead of being Any. The instance attribute on the above serializer will be MyModel | typing.Sequence[MyModel] | None.

To get help

We have Gitter here: https://gitter.im/mypy-django/Lobby If you think you have more generic typing issue, please refer to https://github.com/python/mypy and their Gitter.

Contributing

This project is open source and community driven. As such we encourage contributions big and small. You can contribute by doing any of the following:

  1. Contribute code (e.g. improve stubs, add plugin capabilities, write tests etc) - to do so please follow the contribution guide.
  2. Assist in code reviews and discussions in issues.
  3. Identify bugs and issues and report these

You can always also reach out in gitter to discuss your contributions!

Metadata

Release files for djangorestframework-stubs 3.18.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangorestframework-stubs 3.18.2
File Size Uploaded Provenance Actions
djangorestframework_stubs-3.18.2.tar.gz 37.8 kB With provenance Details for djangorestframework_stubs-3.18.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for djangorestframework-stubs 3.18.2
File Interpreter ABI Platform Actions
djangorestframework_stubs-3.18.2-py3-none-any.whl Python 3 none any Details for djangorestframework_stubs-3.18.2-py3-none-any.whl

Total release size: 95.9 kB

Release files / djangorestframework_stubs-3.18.2.tar.gz

Download URL djangorestframework_stubs-3.18.2.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8e009eee5e7c78c0a0a28cc69875bd1a44bde5499de085e52461479dc9522b1
BLAKE2b-256 checksum
How to use checksums
e59c4b03ddfad674f1af89fed3d17638fd6e5893c2e5d33871689a135cbef5e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / djangorestframework_stubs-3.18.2-py3-none-any.whl

Download URL djangorestframework_stubs-3.18.2-py3-none-any.whl
Size 58.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb4bffc3037063535390fd2cfde11f81c182e05949220d4742ffc0485218972c
BLAKE2b-256 checksum
How to use checksums
fe0c8778cb6fdc650867ecef1b2e5fbc6004906d37cb7bd4a781bf25f503f57d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for djangorestframework-stubs 3.18.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for djangorestframework_stubs-3.18.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.18.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page