-
Notifications
You must be signed in to change notification settings - Fork 767
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
Meta, Docs: Reactive attributes that are assigned to inside __init__ need to be documented inside __init__ #1572
Comments
I think I've finally narrowed it down. It isn't about different-case at all! It's if there's a reference to an instance attribute within |
According to the current working of out documentation generation pipeline, this is the way to document a reactive property that is referred to within the owner class' __init__. See Textualize#1572 and Textualize#1564.
So, to conclude, if a class has a reactive, that is assigned to inside the class' class Foo( Widget ):
bar = reactive( "" )
"""This is the docstring"""
def __init__( self, baz: str ) -> None:
self.bar = baz But this: class Foo( Widget ):
bar = reactive( "" )
def __init__( self, baz: str ) -> None:
self.bar = baz
"""This is the docstring""" Doing the former causes mkdocstrings(?) to see the reactive as not having documentation. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Right, nope, it's still not what I discovered above; there's a further refinement to this. It isn't that the content of class Foo( Widget ):
def __init__( self, baz: str ) -> None:
self.bar = baz
bar = reactive( "" )
"""This is the docstring""" |
@davep as of yesterday, griffe got the PR mkdocstrings/griffe#135 that fixes this so that 0.25.6 will preserve the docstring it finds if it is the only one. |
Related issues: #1572, mkdocstrings/griffe#128. Related PRs: mkdocstrings/griffe#135.
* First prototype of PB. * Repurpose UnderlineBar. * Factor out 'Bar' widget. * Revert "Factor out 'Bar' widget." This reverts commit 0bb4871. * Add Bar widget. * Cap progress at 100%. * Add skeleton for the ETA label. [skip ci] * Add ETA display. * Improve docstrings. * Directly compute percentage. * Watch percentage changes directly. [skip ci] * Documentation. * Make reactive percentage private. Instead, we create a public read-only percentage property. * Update griffe to fix documentation issue. Related issues: #1572, mkdocstrings/griffe#128. Related PRs: mkdocstrings/griffe#135. * Add example and docs. * Address review feedback. [skip ci] * More documentation. * Add tests. * Changelog. * More tests. * Fix/fake tests. * Final tweaks.
[Note that the subject of this issue has been modified to reflect the conclusion of this issue]
This is a bit of a meta issue that affects how the Textual docs are generated. I'm creating it as a fresh issue in our own repo as it's not obvious to me at the moment what the cause of the problem is, and I also can't recreate it in isolation right now.
This initially stems from #1564, where when I created #1570 to add docstrings for
TITLE
,title
,SUB_TITLE
andsub_title
, only the upper-cased versions of those class attributes appear in the docs. I created this repo to try and isolation the problem, and see what part of the documentation pipeline might be responsible, but the result there is fine:So.. hence this issue. I'll track what I find here and if I find that some other tool is responsible (rather than it being a configuration issue for our docs, for example) I'll then go on to raise an issue there.
The text was updated successfully, but these errors were encountered: