-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add option to document properties using autoproperty instead of autoattribute #197
base: main
Are you sure you want to change the base?
Conversation
Might wanna wait for #196 to make sure this actually passes with sphinx-dev |
public_properties, all_properties = \ | ||
get_members_class(obj, 'property', | ||
include_base=include_base) | ||
if properties_are_attributes: | ||
ns['attributes'].extend(public_properties) | ||
ns['all_attributes'].extend(all_properties) | ||
else: | ||
ns['properties'] = public_properties | ||
ns['all_properties'] = all_properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the real change.
Want to revisit #134 after this, too and then we can cut a release? |
I am pro making this new behavior the default. @WilliamJamieson said to me that automodapi predates autoproperty in sphinx. I see no good reason why we should use this everywhere. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
==========================================
- Coverage 90.29% 90.05% -0.25%
==========================================
Files 30 31 +1
Lines 1206 1227 +21
==========================================
+ Hits 1089 1105 +16
- Misses 117 122 +5 ☔ View full report in Codecov by Sentry. |
@WilliamJamieson , please rebase to pick up devdeps fixes. Thanks!
Might be surprising for downstream packages. Are you sure?! |
77be352
to
09aeffb
Compare
Sure things change when you upgrade packages. I think this is a straight upgrade, with no real downside other than "different". If we want to we could make it throw a warning until someone explicitly sets the config flag? |
Given @eteq originally wrote this and @astrofrog then patched it (9 years ago!), maybe they have opinions? If not, maybe at least a draft PR to astropy with this branch to compare before merge? |
Currently attributes and properties are treated the same by
automodapi
when it comes to generating documentation. This is problematic if one wants to do things like have the return type of aproperty
type hint to be included in the documentation. Theautoproperty
directive can do this, where as theautoattribute
cannot.This PR adds the config option
automodsumm_properties_are_attributes
which whenTrue
(the default) treats all properties like they are attributes and whenFalse
treats them using theautoproperty
directive.