Mypy fails on Python 3.12 TypeAliasType compatibility branch

Open Beginner friendly
#178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
tooling

Research direction

Start with src/browserbase/_utils/_typing.py lines 54-56 and reproduce the failure using Python 3.12 with the repository dev dependencies. Check how the tuple annotation and type guard represent both TypeAliasType implementations, then run python -m mypy src. Done means the strict type check passes on Python 3.12 while preserving the intended narrowing.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
93
Forks
16
Avg merge
11m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browserbase/sdk-python

All issues in browserbase/sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.