python / python/typeshed

Decouple collections.abc types from typing aliases

Open
#6,257 11 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stubs: improvement
Dominant language
Python
Stars
5.1k
Forks
2.1k
Avg merge
1d 19h
Merged PRs (30d)
82

Description

At the moment, collections.abc types are strict aliases for their typing counterparts. This can make it difficult for intellisense providers to distinguish them and suggest the correct one. @erictraut mentioned that for pyright: https://github.com/microsoft/pylance-release/issues/1001#issuecomment-787475406.

Although this would likely be a lot of code duplication in the short term, I propose to copy the type definitions to the _collections_abc.pyi module guarded by sys.version_info >= (3, 9).

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.

Research direction

Start by reading the existing collections.abc and typing stub definitions, especially _collections_abc.pyi and the related aliases. Check how the sys.version_info >= (3, 9) guard is used elsewhere and review the linked pyright discussion. Done means collections.abc types have distinct copied definitions rather than strict typing aliases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.