Mypy fails on Python 3.12 TypeAliasType compatibility branch
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu với các dòng 54-56 trong src/browserbase/_utils/_typing.py và tái hiện lỗi bằng Python 3.12 với các dependency dành cho phát triển của repository. Kiểm tra cách tuple annotation và type guard biểu diễn cả hai triển khai TypeAliasType, sau đó chạy python -m mypy src. Hoàn tất khi kiểm tra kiểu nghiêm ngặt chạy thành công trên Python 3.12 mà vẫn giữ được narrowing dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Running the repository's pinned mypy (1.17) under supported Python 3.12 fails in the shared typing helper because _TYPE_ALIAS_TYPES is annotated as containing type[typing_extensions.TypeAliasType], then appends the distinct stdlib typing.TypeAliasType class.
Code reference
src/browserbase/_utils/_typing.py:54-56
Reproduction
With Python 3.12 and the repository dev dependencies:
python -m mypy src
Actual error:
src/browserbase/_utils/_typing.py:56: error: Argument 2 to <tuple> has incompatible type
type[typing.TypeAliasType]; expected type[typing_extensions.TypeAliasType] [arg-type]
Expected behavior
The strict type-check command should pass on supported Python versions, including Python 3.12 where typing.TypeAliasType exists. The tuple annotation/type guard should model both runtime implementations (or use a suitably common type[object] representation while preserving narrowing).
Actual behavior
Mypy reports a source error on Python 3.12. The current CI lint job uses the repository's minimum Python selected by .python-version, so this version-dependent branch is not checked.
Why it matters
This is a core/shared typing utility used to recognize both stdlib and backport aliases. A Python-version matrix for type checking would catch this class of conditional typing regression.
- Ngôn ngữ chính
- Python
- Star
- 93
- Fork
- 16
- Merge trung bình
- 11 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của browserbase/sdk-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#182 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
browserbase/sdk-python#180 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#179 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#176 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
browserbase/sdk-python#175 ·
Tất cả issue của browserbase/sdk-python
Issue tương tự
-
documentation help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
simonw/sqlite-utils#872 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100