googleapis / googleapis/google-cloud-python

Make sure type checks pass with mypy as well

Đang mở
#15,652 8 bình luận 5 reaction 1 người được giao Được @abbrowne126 nhận Xem trên GitHub
api: pubsub priority: p3 type: process
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.