Skip to content

Add type hints to wcwidth for better IDE support #137

@su2u4-1

Description

@su2u4-1

Written by chatGPT

Background
Currently, the wcwidth library does not include any type hints, which prevents IDEs and static type checkers (e.g., mypy, Pyright) from inferring parameter and return types correctly.

Proposal

  • Add .pyi stub files or inline type annotations following PEP 484 to provide comprehensive type information.
  • Optionally, contribute the stubs to typeshed or publish a separate types-wcwidth package on PyPI.

Benefits

  • Improved IDE auto-completion and documentation lookup.
  • Enhanced compatibility with static type checkers, reducing potential runtime errors.
  • Easier onboarding for new contributors and users who rely on type safety.

I’m not a native English speaker and used a translation tool—please feel free to suggest any wording improvements!

I wrote it myself

wcwidth does not contain any type hint, so the IDE cannot correctly infer the type
Therefore, I suggest adding type hint, such as adding .pyi file

Because my English is not good, I used Google Translate and chatGPT, please forgive me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions