Mypy fails on Python 3.12 TypeAliasType compatibility branch

Đang mở Phù hợp với người mới
#178 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
tooling

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của browserbase/sdk-python

Tất cả issue của browserbase/sdk-python

Issue tương tự

Thêm issue về Python

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.