googleapis / googleapis/google-cloud-python

Make sure type checks pass with mypy as well

Offen
#15,652 8 Kommentare 5 Reaktionen 1 zugewiesene Person Beansprucht von @abbrowne126 Auf GitHub ansehen
api: pubsub priority: p3 type: process
Vorherrschende Sprache
Python
Sterne
5.4k
Forks
1.8k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
122

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.