python / python/mypy

stubgen: `--include-private` not effective for C modules

Open
#10,580 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

Bug Report

--include-private option of stubgen is not effective for C modules.

To Reproduce

Generate a stub for C modules with private members, e.g., by cythonizing:

# foo.pyx
def _foo(): pass

Then run stubgen -m foo to generate a stub.

Expected Behavior

_foo() does not appear in the stub unless --include-private is specified.

Actual Behavior

_foo() always appear in the stub.

Your Environment

  • Mypy version used: 0.812
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: 3.7.8
  • Operating system and version: Ubuntu 18.04

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 the stubgen entry point and reproduce the issue using the shown foo.pyx C-module example, then compare output from stubgen -m foo with and without --include-private. Done means private members such as _foo() are omitted by default and included only when the option is specified; add or run the relevant stubgen regression test if one is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
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.