mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Add section to docs for mypy plugin
This commit is contained in:
parent
146797f549
commit
423104fa7a
2 changed files with 31 additions and 1 deletions
|
|
@ -69,6 +69,7 @@ Further documentation
|
|||
patterns
|
||||
values
|
||||
cookbook
|
||||
mypy
|
||||
changes
|
||||
|
||||
Alternatives
|
||||
|
|
@ -95,4 +96,4 @@ requests and bug reports:
|
|||
|
||||
https://github.com/jazzband/django-configurations/issues
|
||||
|
||||
Thanks!
|
||||
Thanks!
|
||||
|
|
|
|||
29
docs/mypy.rst
Normal file
29
docs/mypy.rst
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
mypy plugin
|
||||
===========
|
||||
|
||||
Due to Django's dynamic nature, some `mypy plugins`_ such as `django-stubs`_
|
||||
and `djangorestframework-stubs`_ need to (partially) execute your Django code to
|
||||
properly derive type information. The django-configurations mypy plugin calls
|
||||
``configurations.importer.install()`` to initialize your settings on startup so
|
||||
that plugins like django-stubs and djangorestframework-stubs can work with
|
||||
projects using django-configurations.
|
||||
|
||||
.. _`mypy plugins`: https://mypy.readthedocs.io/en/stable/extending_mypy.html#extending-mypy-using-plugins
|
||||
.. _`django-stubs`: https://github.com/typeddjango/django-stubs
|
||||
.. _`djangorestframework-stubs`: https://github.com/typeddjango/djangorestframework-stubs
|
||||
|
||||
Note, the django-configurations mypy plugin must come before plugins that
|
||||
need it in your mypy configuration file. Example ``plugins`` value if configuring
|
||||
mypy with ``pyproject.toml``:
|
||||
|
||||
|
||||
.. code-block:: toml
|
||||
:emphasize-lines: 9, 11-12
|
||||
|
||||
plugins = [
|
||||
"configurations.mypy_plugin",
|
||||
"mypy_django_plugin.main",
|
||||
"mypy_drf_plugin.main",
|
||||
]
|
||||
|
||||
..
|
||||
Loading…
Reference in a new issue