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.
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:
pip install django-autotyping
To make use of the dynamic stubs feature, you will also need to install django-stubs:
pip 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:
AUTOTYPING = {
"STUBS_GENERATION": {
"LOCAL_STUBS_DIR": Path(BASE_DIR, "typings"),
}
}
To get typing and auto-completion support, you can make use of the
AutotypingSettingsDicthelper:from django_autotyping.typing import AutotypingSettingsDict AUTOTYPING: AutotypingSettingsDict = { ... }
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.
Release files for django-autotyping 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_autotyping-0.5.1.tar.gz | 79.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_autotyping-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.4 kB
Release files / django_autotyping-0.5.1.tar.gz
| Download URL | django_autotyping-0.5.1.tar.gz |
|---|---|
| Size | 79.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b48c57d3d358a608109dd47698e64466e596983e8729bff130669dd744588c25
|
|
BLAKE2b-256 checksum How to use checksums |
7bd465d2b1c54f35116bd2d31d1064c523ded729353633389ecfc283a93b4c47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / django_autotyping-0.5.1-py3-none-any.whl
| Download URL | django_autotyping-0.5.1-py3-none-any.whl |
|---|---|
| Size | 96.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ee6ecd32a8d16e858ebce06d8d7ca5b477b32752a8143de48edc67b97d9084d
|
|
BLAKE2b-256 checksum How to use checksums |
c798824638898b8272178610268e126cca4f35e0ac05536153f559c299149ac6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|