Add ruff rules to enforce typing annotations#1197
Add ruff rules to enforce typing annotations#1197Lotram wants to merge 2 commits intoGothenburgBitFactory:developfrom
Conversation
…otifications.py - Add type annotations to all functions in the enforced files - Enforce ruff ANN rules on these files (ignore ANN401 globally) - Exclude services/, tests/, docs/ from ANN enforcement
Also add annotations for azuredevops and bitbucket, as examples
|
Does annotating all functions necessarily improve typing coverage (as enforced by ty)? Doesn't ty complain if it can't infer a type? |
Not really, all missing annotations are replaced by See for example this piece of code: without type annotation, whereas raises an error with both All type checkers require type annotations to be fully working. Both |
| return response.json() | ||
| else: | ||
| # Older python-requests | ||
| return response.json |
There was a problem hiding this comment.
Can we constrain requests>=1 in pyproject.toml? (based on first item: https://requests.readthedocs.io/en/stable/api/#migrating-to-1-x)
Add ruff rules ANN to ensure all functions are annotated, improving typing coverage.
First commit enforces this everywhere except
services/( +docs/andtests/, already excluded from type checking).Second commit enforces it in
services/__init__.py+ 2 services, as an example