Django Autotyping¶
django-autotyping
enhances your developing experience with Django by providing accurate type hints, without the need for
a custom IDE or mypy plugin:
- Generates custom type stubs based on the current state of your Django application, enhancing your development experience by providing auto-completions and accurate type checking.
- Automatically add explicit type hints to your source code when type stubs are not enough.
To understand the why and how, you can refer to the context section.
django-autotyping
is built with LibCST.
Still in development
This project is still work in progress. It is meant to work with django-stubs
, but some improvements and changes are probably going to be
implemented in the stub definitions, and could potentially require some changes to the generated stubs.
Installation¶
Through pip
:
To make use of the dynamic stubs feature, you will also need to install django-stubs
:
Configuration¶
As any Django application, you will need to add django_autotyping
to your INSTALLED_APPS
(preferably in your development or local settings, if you already have them separated).
The application is configurable through the AUTOTYPING
dict:
Type checking configuration
To get typing and auto-completion support, you can make use of the
AutotypingSettingsDict
helper:
django-autotyping
provides several linting rules, identified with the pattern DJA00X
or DJAS00X
. Rules can be disabled
using the IGNORE
setting value.
For a complete list of available configuration values, refer to the usage section of dynamic stubs and explicit type hints.