-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Class data members are included in the documentation when the type is explicitly defined. #280
Comments
Hi there! This is more or less expected behavior. pdoc documents all attributes that have either a docstring or a type annotation. We don't document members for which neither is present, mostly because there's really not much to document. If you want members to not be public, I'd recommend you prefix them with an underscore, which is a more general Python convention. Does that make sense? |
Probably. I wasn't prefixing the data members with underscores (as I should have been), but I also use type annotations everywhere. It didn't bother me at all because the type of the data members was correctly inferred in 99% of cases. But then I needed something like |
By "I also use type annotations everywhere", you mean everywhere but for attributes/data members? I guess I do have some sympathy for your use case. A reasonable change here would be to only add variables with docstrings instead of adding variables that have a docstring, an annotation, or both. I think it should be enough to remove those four lines: Lines 475 to 476 in fdb6fde
Lines 583 to 584 in fdb6fde
I feel both approaches are valid, maybe other folks want to chime in. :) |
There's no need, because the data members are typically defined like def __init__(self):
...
self.foo = Foo()
... where the |
You've convinced me here, this behavior will be changed with the next release! |
Problem Description
As I understand it, pdoc does not document the class data members by default.
But, when the data member type is specified explicitly in
__init__()
, pdoc documents it by default.Steps to reproduce the behavior:
Data member
a
is not included in theFoo
class documentation, but data memberb
is.System Information
The text was updated successfully, but these errors were encountered: