Add typing to all Python code

Description

Currently, type hints are rare in Wazo Platform code. We need to increase the typing hints coverage to help development, debugging and static analysis.

TODO: create more child issues for wazo-*-client and other libs

Zendesk Ticket IDs

None
46% Done
Loading...
0% Done
Loading...

Activity

Show:

Charles Langlois December 19, 2022 at 4:10 PM

And yes in bullseye we could use python 3.9 to run mypy, I don’t think there would be an issue?

Charles Langlois December 19, 2022 at 4:07 PM

Are you sure that a new tox env is automatically run by zuul? There are three zuul jobs used to run different tox environments I think. Of course we could include mypy typechecking in the “linting” environment, if that’s what you mean.

Jesse Sopel December 19, 2022 at 2:10 PM
Edited

If we include mypy in tox it should run automatically. The only issue is if we want to run the type checker with a more up to date version of Python as it may not be installed on the current runner. Which I really think we should do. Ideally 3.10, but at the very least we should run with 3.9+ because we won’t have to go re-optimise everything when we update to bullseye

Charles Langlois December 14, 2022 at 9:42 PM
Edited

Good question, I assume so. https://stackoverflow.com/questions/56532731/check-type-hint-coverage-in-python
There are ways to generate reports, I assume similar to test coverage reports.

Sébastien Duthil December 14, 2022 at 8:52 PM

You’re right, we should define a coverage target below 100%. Thing is: I don’t know how to measure typing coverage… Can mypy do that?

Details

Assignee

Reporter

Labels

Priority

Epic Name

Zendesk Support

Created December 9, 2022 at 6:27 PM
Updated October 1, 2024 at 3:49 PM