Skip to main content

Django mypy stubs

Project description

mypy logo

pep484 stubs for Django framework

Build Status Checked with mypy

This package contains type stubs and mypy plugin to provide more precise static types and type inference for Django framework. Django uses some Python "magic" that makes having precise types for some code patterns problematic. This is why we need to accompany the stubs with mypy plugins. The final goal is to be able to get precise types for most common patterns.

Supports Python 3.6/3.7, and Django 2.1.x series.

Could be run on earlier versions of Django, but expect some missing imports warnings.


pip install django-stubs

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

plugins =

in your mypy.ini file.


In order to specify config file, set MYPY_DJANGO_CONFIG environment variable with path to the config file. Default is ./mypy_django.ini

Config file format (.ini):


# specify settings module to use for django.conf.settings, this setting
# could also be specified with DJANGO_SETTINGS_MODULE environment variable
# (it also takes priority over config file)
django_settings = mysettings.local

# if True, all unknown settings in django.conf.settings will fallback to Any,
# specify it if your settings are loaded dynamically to avoid false positives
ignore_missing_settings = True

# if True, unknown attributes on Model instances won't produce errors
ignore_missing_model_attributes = True

To get help

We have Gitter here

If you think you have more generic typing issue, please refer to and their Gitter.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for emil-fixed-django-stubs, version 0.12.0
Filename, size File type Python version Upload date Hashes
Filename, size emil_fixed_django_stubs-0.12.0-py3-none-any.whl (276.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size emil-fixed-django-stubs-0.12.0.tar.gz (139.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page