python / python/mypy

stubtest: more concise error for forgotten arguments

Open
#13,676 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature topic-stubtest
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Feature

When the implementation adds new arguments (or the stubs forget some of the arguments), stubtest creates many errors if the new/forgotten argument isn't the last argument.

$ cat a.py
def fun(a, b, c, d, e): ...

$ cat a.pyi 
def fun(b, c, d, e): ...

$ python -m mypy.stubtest a --concise
a.fun is inconsistent, stub argument "b" differs from runtime argument "a"
a.fun is inconsistent, stub argument "c" differs from runtime argument "b"
a.fun is inconsistent, stub argument "d" differs from runtime argument "c"
a.fun is inconsistent, stub argument "e" differs from runtime argument "d"
a.fun is inconsistent, stub does not have argument "e"

Pitch

$ python -m mypy.stubtest a --concise
a.fun is inconsistent, stub does not have argument "a"

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 reproducing the example with python -m mypy.stubtest a --concise and inspect the stubtest entry point and its argument-mismatch reporting. Update the concise output so a missing argument produces one error rather than cascading mismatches, then add or update coverage for the shown case and run the relevant stubtest tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.