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

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

django-stubs-0.10.0.tar.gz (141.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_stubs-0.10.0-py2.py3-none-any.whl (276.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-stubs-0.10.0.tar.gz.

File metadata

  • Download URL: django-stubs-0.10.0.tar.gz
  • Upload date:
  • Size: 141.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for django-stubs-0.10.0.tar.gz
Algorithm Hash digest
SHA256 cefbbf7dcc12ba72d72cfaeb9304efe419c9cc8850e66dbcafd6b67eae5787f2
MD5 cee25194c6ed6718870cbc21384d6529
BLAKE2b-256 1c335c552586290a8a0780e3d22bf820172bcac5e49ce79324b9fa757f6d3cc8

See more details on using hashes here.

File details

Details for the file django_stubs-0.10.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_stubs-0.10.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 276.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for django_stubs-0.10.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b57b4792caeeded5e977a3a82fd5216d24a71c8dad0ac20c2b405cd6fa14c8b6
MD5 2fdbe7fbdac82ad63dc9cb1070fa9269
BLAKE2b-256 12bd272d2bc9882118792c67ec9df3716b806309adae91351e80b2f506d27f87

See more details on using hashes here.

Supported by

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