Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubgen builds stubs for private modules #16808

Open
nschloe opened this issue Jan 22, 2024 · 1 comment · May be fixed by #16822
Open

stubgen builds stubs for private modules #16808

nschloe opened this issue Jan 22, 2024 · 1 comment · May be fixed by #16822
Labels
bug mypy got something wrong topic-stubgen

Comments

@nschloe
Copy link

nschloe commented Jan 22, 2024

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].

@nschloe nschloe added the bug mypy got something wrong label Jan 22, 2024
nautics889 added a commit to nautics889/mypy that referenced this issue Jan 26, 2024
* (fix): when --include-private is not passed stubgen omits packages and
  modules which names start with "_" and do not end with "__"
@nautics889 nautics889 linked a pull request Jan 26, 2024 that will close this issue
nautics889 added a commit to nautics889/mypy that referenced this issue Jan 26, 2024
* (chore): add missing type hints
* (docs): add docsting
@nautics889
Copy link
Contributor

@nschloe,

#16822 should fix this. I'd really appreciate if you manage to test it.

nautics889 added a commit to nautics889/mypy that referenced this issue Feb 5, 2024
* (fix): add checking if --include-private passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-stubgen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants