Emit PEP 585 syntax from stubgen
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
stubgen currently does not emit PEP 585 syntax, it should, it is permissible, and typeshed has been using PEP 585 syntax for a long while now.
For example, stubgen outputs the following non-PEP-585 syntax in the most current version.
from typing import Tuple
def get_sim_time() -> Tuple[int, int]: ...
Pitch
stubgen should output PEP-585 syntax.
def get_sim_time() -> tuple[int, int]: ...
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
Start by locating stubgen's annotation-generation entry point and reproduce the shown function example. Trace where typing.Tuple is selected, then verify that generated annotations use tuple[int, int] without the unnecessary typing import. Done means stubgen emits PEP 585 syntax consistently for the affected built-in generic types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100