googleapis / googleapis/google-cloud-python

Make sure type checks pass with mypy as well

オープン
#15,652 コメント 8 件 リアクション 5 件 担当者 1 名 @abbrowne126 が担当を希望しています GitHub で見る
api: pubsub priority: p3 type: process
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

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)

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。