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

verifytypes: Missing docstring not reported for classes and methods from publicly exported classes in private modules #6758

Closed
jakkdl opened this issue Dec 16, 2023 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@jakkdl
Copy link

jakkdl commented Dec 16, 2023

Describe the bug
pyright --verifytypes does not give warnings for missing docstrings in classes or class methods in private modules, even if they are publicly exported in an __init__.py file. Classes in public modules, and functions in private modules, both get warnings reported.

Noticed it when authoring python-trio/trio#2898

Code or Screenshots
test_pkg/__init__.py

from .foo import Foo as Foo
from ._bar import Bar as Bar, barfun as barfun

test_pkg/foo.py

class Foo:
    ...

test_pkg/bar.py

class Bar:
    def bar(self) -> None:
        ...

def barfun(param: str) -> None:
    ...

output:

$ pyright --verifytypes test_pkg --verbose
Module name: "test_pkg"
[...]

Public modules: 2
   test_pkg
   test_pkg.foo

Exported symbols: 5
   test_pkg.foo
   test_pkg.foo.Foo (3 references)
   test_pkg.Foo
   test_pkg.Bar
   test_pkg.barfun

Other referenced symbols: 3
   foo
   test_pkg._bar.Bar
   test_pkg._bar.Bar.bar

Symbols used in public interface:
test_pkg.foo.Foo
   warning: No docstring found for class "test_pkg.foo.Foo"
test_pkg.barfun
  [...]/test_pkg/_bar.py:2:41 - warning: No docstring found for function "test_pkg.barfun"

Symbols exported by "test_pkg": 5
  With known type: 5
  With ambiguous type: 0
  With unknown type: 0
  Functions without docstring: 1
  Functions without default param: 0
  Classes without docstring: 1

Other symbols referenced but not exported by "test_pkg": 3
  With known type: 3
  With ambiguous type: 0
  With unknown type: 0

Type completeness score: 100%

Completed in 0.191sec

The two warnings are correct, but I expected an additional two warnings - one for test_pkg.Bar and one for test_pkg.Bar.bar

VS Code extension or command-line
Command line, version 1.1.341

@jakkdl jakkdl added the bug Something isn't working label Dec 16, 2023
erictraut added a commit that referenced this issue Dec 18, 2023
…en docstrings are missing from a class or function that is defined in a private module but re-exported from a public module. This addresses #6758.
erictraut added a commit that referenced this issue Dec 18, 2023
…en docstrings are missing from a class or function that is defined in a private module but re-exported from a public module. This addresses #6758.
erictraut added a commit that referenced this issue Dec 18, 2023
…en docstrings are missing from a class or function that is defined in a private module but re-exported from a public module. This addresses #6758. (#6771)
@erictraut
Copy link
Collaborator

Thanks for the bug report. This will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Dec 18, 2023
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.342, which I just published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants