googleapis / googleapis/google-cloud-python

Make sure type checks pass with mypy as well

Ouverte
#15,652 8 commentaires 5 réactions 1 personne assignée Réclamée par @abbrowne126 Voir sur GitHub
api: pubsub priority: p3 type: process
Langage dominant
Python
Étoiles
5.4k
Forks
1.8k
Merge moyen
3 j 4 h
PR mergées (30 j)
122

Description

googleapis/python-pubsub#500 added type annotation to the codebase, but we only checked that static type analysis passes under `pytype`. A lot of people, on the other hand, use `mypy`, but `mypy` currently reports 97 errors.

If we want users to leverage our type annotations, we should make sure that the checks pass with `mypy` as well, and then we can also add `py.typed` file to declare the library type-checked.

An additional requirement of this issue is that a new nox session named `mypy` needs to be added and enabled by default.

Acceptance criteria:
- [x] A new nox session named `mypy` is added, and it runs on every PR.
googleapis/python-pubsub#542
- [x] The hand-written layer passes type checks.
googleapis/python-pubsub#542
- [x] The autogenerated part of the library is included in `mypy` checks and produces no errors.
BLOCKED by https://github.com/googleapis/gapic-generator-python/issues/1092
- [x] Code samples are checked with `mypy` and the check runs on every PR (https://github.com/googleapis/python-pubsub/pull/551).
- [ ] Refactor the manual client to inherit from the generated class instead of dynamically injecting the latter's methods. Mypy otherwise cannot know about the dynamically added methods.
- [ ] The library declares itself as type-checked by adding a marker `py.typed` file (requires all above items to be completed first)

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.