Update the section about using mypy and type annotations

- Closes #40
This commit is contained in:
Radoslav Georgiev 2022-01-16 16:15:48 +02:00
parent ea3fb8ad3a
commit df506bc2e2
No known key found for this signature in database
GPG Key ID: 0B7753A4DFCE646D

View File

@ -68,8 +68,8 @@ Django styleguide that we use in [HackSoft](https://hacksoft.io).
+ [Circular imports between tasks & services](#circular-imports-between-tasks--services) + [Circular imports between tasks & services](#circular-imports-between-tasks--services)
* [Periodic Tasks](#periodic-tasks) * [Periodic Tasks](#periodic-tasks)
* [Configuration](#configuration-1) * [Configuration](#configuration-1)
- [Misc](#misc) - [DX (Developer Experience)](#dx-developer-experience)
* [mypy / type annotations](#mypy--type-annotations) * [`mypy` / type annotations](#mypy--type-annotations)
- [Django Styleguide in the Wild](#django-styleguide-in-the-wild) - [Django Styleguide in the Wild](#django-styleguide-in-the-wild)
- [Inspiration](#inspiration) - [Inspiration](#inspiration)
@ -2275,18 +2275,25 @@ Celery is a complex topic, so it's a good idea to invest time reading the docume
We constantly do that & find new things or find better approaches to our problems. We constantly do that & find new things or find better approaches to our problems.
## Misc ## DX (Developer Experience)
### mypy / type annotations A section with various things that can make your Django developer life better.
About type annotations & using `mypy`, [this tweet](https://twitter.com/queroumavodka/status/1294789817071542272) resonates a lot with our philosophy. ### `mypy` / type annotations
We have projects where we enforce `mypy` on CI and are very strict with types. When it comes to using type annotations, alongside [`mypy`](https://mypy.readthedocs.io/en/stable/index.html), [this tweet](https://twitter.com/queroumavodka/status/1294789817071542272) **resonates a lot with our philosophy.**
We have projects where types are looser. - We have projects where we enforce `mypy` and are very strict about ot.
- We have projects where types are looser and `mypy` is not used at all.
Context is king here. Context is king here.
In the [`Django-Styleguide-Example`](https://github.com/HackSoftware/Django-Styleguide-Example), we've configured `mypy`, using both <https://github.com/typeddjango/django-stubs> and <https://github.com/typeddjango/djangorestframework-stubs/>. You can check it as an example.
Additionally, this particular project - <https://github.com/wemake-services/wemake-django-template> - also has `mypy` configuration.
Figure out what is going to work best for you.
## Django Styleguide in the Wild ## Django Styleguide in the Wild
Here's a collection of different folks & companies, that have found the styleguide useful. Here's a collection of different folks & companies, that have found the styleguide useful.