Skip to content

Draft: Enforce typing

Piotr Gawron requested to merge enforce-typing into master

Add mypy to build process to validate if type hints are respected.

Few things that are still not done:

  • generic type hints don't work in Python 3.6 (if we decide to use it we need to drop support for python 3.6)
  • Generic types for django ModelForm/Field does not work
  • Generic types for django ListView/CreateView/UpdateVie does not work
  • get_user_model() is not discovered properly
  • screening number should be changed into array - current implementation enforce violation of some types, and is hard to maintain (sorting cannot be done in db)
  • find a way to properly type django magic:
    def image_img(self) -> str:
       return '<img class="flag-icon" src="%s" />' % self.image.url
    image_img.short_description = 'Flag icon'  # type: ignore
Edited by Piotr Gawron

Merge request reports