We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Type checking your Django code with django-types and Pyright with Kyle Bebak - DjangoCon US 2022
Learn how to add type hints to your Django code and improve code correctness and quality with Pyright and django-types, and discover the benefits of type checkers like PyWrite and PyType.
Key Takeaways
- Adding type hints to Django code can help with correctness and improvement of code navigation
- Type checkers like PyWrite and PyType can help reduce errors and improve code quality
- PyWrite is a type checker that can resolve dependencies and provide language server capabilities
- Using type annotations can help provide extra safety and make code harder to break
- Type checkers can inform the developer of potential problems, such as incorrect type assignments
- PyType is a fork of Django REST framework stubs that is compatible with any type checker
-
Installing dependencies with Poetry and configuring PyWrite with a
pyrite-config.json
file can help with type checking - Adding type hints to models can help with correctness and provide extra safety
- Using language server protocols (LSP) can provide features like auto-completion and code navigation
- Implementing type hints for Django models can be beneficial for code quality and maintainability
- Installing type stubs as project dependencies can help with type checking
-
Configuring PyWrite with a
pyrite-config.json
file can help with resolving dependencies and providing language server capabilities