Skip to main content
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.

Installation

pip install django-stubs

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

[mypy]
plugins =
    mypy_django_plugin.main

in your mypy.ini file.

Configuration

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):

[mypy_django_plugin]

# 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 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.

Release files for emil-fixed-django-stubs 0.12.0

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

Source distribution (sdist)

Source distribution for emil-fixed-django-stubs 0.12.0
File Size Uploaded
emil-fixed-django-stubs-0.12.0.tar.gz 139.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for emil-fixed-django-stubs 0.12.0
File Interpreter ABI Platform
emil_fixed_django_stubs-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 416.0 kB

Release files / emil-fixed-django-stubs-0.12.0.tar.gz

Download URL emil-fixed-django-stubs-0.12.0.tar.gz
Size 139.0 kB
Tags Source
SHA-256 checksum
How to use checksums
72eb4b3d1b00eb1182c58efec14cb640b2cddc91e7d7fab0b0d5c3ceb3a506a6
BLAKE2b-256 checksum
How to use checksums
c09475160c91e1d8e2e73ada08b1e937c7d5f84e1f5f32cfce41f17b20d9bb33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release files / emil_fixed_django_stubs-0.12.0-py3-none-any.whl

Download URL emil_fixed_django_stubs-0.12.0-py3-none-any.whl
Size 276.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcb97b3b9215e874a1079e49d33ccd2bac0a5fd16ae81bbb1cd5c21ccfc3ac97
BLAKE2b-256 checksum
How to use checksums
9caf35e50bcf1f5fef0c2695e99f39b21d84736c5f719327dc477ad6374521fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

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