[Feature Request] Better static type checking support
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
running ty check ty-issue-1135.py raises a type error:
# ty-issue-1135.py
import dash
dropdown = dash.dcc.Dropdown(
id="dropdown",
options=list(range(5))
)
dropdown.id # error[unresolved-attribute] Type `Dropdown` has no attribute `id`
as @carljm proposed in https://github.com/astral-sh/ty/issues/1135#issuecomment-3259155919 since the body of classes like dash.dcc.Dropdown is auto-generated
... it wouldn't be hard for dash to also generate a id
: typing.Optional[typing.Union[str, dict]]annotation on the class body (not just in the__init__signature) -- that would resolve the problem.
where the problem is that neither pyright nor mypy nor ty understand the attributes present on dash.dcc.Dropdown and other dash classes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run ty check ty-issue-1135.py to reproduce the unresolved-attribute error, then inspect how dash.dcc.Dropdown and other Dash classes are auto-generated. Done means generated class bodies expose attributes such as id so pyright, mypy, and ty no longer report them as unresolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100