googleapis / googleapis/google-cloud-python

Make sure type checks pass with mypy as well

Abierto
#15,652 8 comentarios 5 reacciones 1 asignado Reclamado por @abbrowne126 Ver en GitHub
api: pubsub priority: p3 type: process
Lenguaje dominante
Python
Estrellas
5.4k
Forks
1.8k
Merge medio
3 d 4 h
PR fusionados (30 d)
122

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.