Skip to content

Topic/default/types annotations and cleaning


This series is the result of our last sprint where we tested pyannotate to
generates types annotations from runtime analysis of our tests.:

I've also included some cleaning work I was doing on the side when trying to do this damn refactoring on yams was breaking my brain a bit too much.

To give a feedback on using pyannotate as a tool to introduce types annotations in a project in comparison from doing everything by hand:

  • it totally save a lot of time in comparison of doing everything by hand
  • it's clearly not out of the box, we've had to fix some stuff from the
    generated analysis and then to please mypy (and it tooks me a few days to
    finish this work)
  • but it's still worth it has it automates a lot what I was doing by hand
  • it doesn't have the quality of doing everything by hand and checking
    everything by hand but it's still a win to start introducing types
  • for our case it's based on tests data so it might not be perfect

For this series I've been focusing only on making mypy happy from the generated types so it's clearly not optimal but I will definitively used pyannotate again as a good way to bootstrap adding type annotations to a project.

This series also include the common list of good practices that are starting to be included in all logilab's projects:

  • black integration taken from yams that was taken from nemo
  • flake8 compatible with black from the same source
  • fyi I've tested for flake8 cleaning, it
    helps a bit but doesn't do a lot of works
  • check-manifest integration
  • some minor cleaning raised by mypy/flake8 regarding python3 compatibility

Kind regards,

Merge request reports