python / python/mypy

Stubgen support for positional only parameters as per PEP 570

Open
#14,138 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature

Stubgen should recognize a signature in the shape of func(param1: T1, param2: T2, /) -> T3 if given in the docstring.

Pitch

As https://peps.python.org/pep-0570/ describes, this is common with C extensions. There is currently no way to express these signatures in a way that stubgen can understand and regenerate correctly in the stub.

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 with stubgen's handling of signatures found in extension-module docstrings and compare the required syntax with PEP 570. Verify the generated stub preserves positional-only parameters using the / marker and add or update coverage for a signature such as the one in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.