python / python/mypy

stubgen builds stubs for private modules

Open
#16,808 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In a Python package consisting of only one file

foobar/_main.py
# _main.py
def f(x: int) -> int:
    return x + 1

the function f can only be reached via a private path, namely _main.f. Still, when running

stubgen foobar/

the corresponding stub is created in

out/_main.pyi

without specifying --include-private.

This is with mypy 1.8.0 [Python 3.11.6].

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 issue with the shown foobar/_main.py package and the stubgen foobar/ command. Trace how stubgen handles private modules and compare the result with the --include-private option. Done means the private module is not emitted without that option, while the documented inclusion behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.