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.

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.

Project details


Download files

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

Source Distribution

emil-fixed-django-stubs-0.12.0.tar.gz (139.0 kB view details)

Uploaded Source

Built Distribution

emil_fixed_django_stubs-0.12.0-py3-none-any.whl (276.9 kB view details)

Uploaded Python 3

File details

Details for the file emil-fixed-django-stubs-0.12.0.tar.gz.

File metadata

  • Download URL: emil-fixed-django-stubs-0.12.0.tar.gz
  • Upload date:
  • Size: 139.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for emil-fixed-django-stubs-0.12.0.tar.gz
Algorithm Hash digest
SHA256 72eb4b3d1b00eb1182c58efec14cb640b2cddc91e7d7fab0b0d5c3ceb3a506a6
MD5 763075f7c916fb91d7c0e81570a119c6
BLAKE2b-256 c09475160c91e1d8e2e73ada08b1e937c7d5f84e1f5f32cfce41f17b20d9bb33

See more details on using hashes here.

File details

Details for the file emil_fixed_django_stubs-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: emil_fixed_django_stubs-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 276.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for emil_fixed_django_stubs-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb97b3b9215e874a1079e49d33ccd2bac0a5fd16ae81bbb1cd5c21ccfc3ac97
MD5 ecd35df71b1c9ef542d712c07b535c25
BLAKE2b-256 9caf35e50bcf1f5fef0c2695e99f39b21d84736c5f719327dc477ad6374521fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page