Encourage typing_extensions.Unpack for many overload-invariant keywords

Open
#285 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start by reviewing the pandas.read_csv stub example linked in the issue and the project's existing rule implementations and tests. Determine how a rule could identify overload-invariant keyword arguments and what threshold should trigger an Unpack recommendation. Done means the behavior and heuristic are specified, implemented, and covered by tests.

Written by the indexing model from the issue text.

Description

deferred

If a function has many keyword arguments that do not change across all overloads (for example pandas.read_csv). It is more readable and shorter to move all the overload-invariant keywords into a TypedDict and suggest using the Unpack feature which is supported by at least pyright and mypy.

This would probably need some heuristic of when is it worth recommending Unpack: Using a TypedDict for less than insert magic number keywords is probably not helpful.

Dominant language
Python
Stars
84
Forks
26
Avg merge
1d 21h
Merged PRs (30d)
2

Getting set up

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 PyCQA/flake8-pyi

All issues in PyCQA/flake8-pyi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.