-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
@property
inconsistently documented
#574
Comments
It looks like the issue is that the @properties don't have docstrings; I find this behavior rather curious. What is the justification for the default being to not document these? |
I don't have strong opinions about the choice of intended behavior either (everything that needs to be documented should be in the end), but there is still inconsistency. According to #280, "pdoc documents all attributes that have either a docstring or a type annotation." (emphasis mine), but properties are only being documented if there is a docstring and type annotation. Indeed, this property has both while this property is only annotated, and only former appears in the docs. |
#280 is older than #411, see mhils@a6f21be |
Thank you for your rapid responses. Well, that's certainly a conundrum- you have users with diametrically opposing positions here! I guess my opinion coming into this was that (by default) everything should be documented. I personally prefer this because it shows developers explicitly what still needs documentation, and at least half of the utility of code documentation for users is to show what exists. Perhaps this whole issue could be resolved through additional documentation in pdoc's Quickstart. This could be easily be roped into the opening beats; I propose editing the Quickstart example to include something with neither type annotations or a docstring and changing
into
(or a derivative of the above that doesn't dramatically alter the flow of the whole section), with the additional subtleties being noted under the "How can I document variables" section. I think this is a fundamental enough design choice that it deserves a prominent spot on that page. |
Ah, I didn't quite pick that out of the thread. It does nonetheless feel a bit weird for the case of properties, since although they act like variables in syntactic respects, being a |
Thank you two! I think there's a strong argument that variables shouldn't behave any other from functions or classes in terms of default visibility. I've just pushed #575, which makes it so that variables are documented by default - irrespective of whether they have a docstring or not. I've linked this issue in the changelog - if someone comes up with a convincing use case for why this is particularly annoying, we might add a |
* document variables by default, even if they have no docstring or type annotation. refs #574 * [autofix.ci] apply automated fixes * fixup * tests++ --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Forgot to update here - this should be fixed with pdoc 14! 🍰 |
Problem Description
Our codebase uses a lot of
@property
and we're seeing that only some of these are documented.Most curious to me is the fact that
TIEntry.data_length
is documented while the other@property
s are not.Steps to reproduce the behavior:
bug.py
python3 -m pdoc bug.py
but our CI does it normally, but I doubt this matters)@property
code is not documented.System Information
Paste the output of "pdoc --version" here.
pdoc 13.1.1, python 3.10
The text was updated successfully, but these errors were encountered: