-
Notifications
You must be signed in to change notification settings - Fork 134
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
Allow finer-grained control over display of inherited members #417
Comments
You'd be using undocumented parts of AutoAPI, but I think you can achieve what you're looking for. def skip_some_inherited_members(app, what, name, obj, skip, options):
if not obj.inherited:
return None
original_path = obj.obj.get("original_path")
if not original_path:
return None
# If you want to inspect the original object
#original_obj = app.env.autoapi_all_objects.get(original_path)
#if not original_obj:
# return None
# If checking the original location is enough.
# For example to ignore inherited attributes from enums.
#if original_obj.startswith("enum."):
# return False
return None |
We currently don't document much of the API of objects. They get used in templates and in hooks like this. So by not documenting that bit of the API, we make use cases like this more difficult to navigate. So I think that the right solution here is this documentation. |
Actually, |
Hi, I came to this issue because I am exactly in the situation described by @td-anne . While the use of
@AWhetter : is there some fundamental objection against that type of solution? |
When we generate documentation for classes, we have two situations:
If a given project contains only one of these categories, we can select
inherited-members
or not as appropriate. But if we have both situations in the same project, there does not seem to be a way we can get the desired behaviour.Ideally I would like to be able to set something on the class definition (perhaps in the class docstring?) that would control whether this class showed inherited members. (Perhaps this could even work recursively up the inheritance graph, so that deriving from a class that didn't show its inherited members I could show members inherited from that class but not its superclasses.)
Sadly
autoapi-skip-member
does not provide enough information (as far as I can tell) to inspect the (docstring of the) class that the object is a member of. It does at least provideobj.inherited
, which is a key piece of information.I suppose I could maintain a list of classes that did or did not want their inherited members documented, and perhaps I could use the fully qualified name to check whether objects in
autoapi-skip-member
were members of one of these classes. Having to maintain this list separately from the classes being documented seems error-prone.The text was updated successfully, but these errors were encountered: