Skip to content

[Python APIView] Display inherited instance variables #10703

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 21, 2025

Feature

This PR adds support for displaying inherited instance variables (ivars) in Python APIView, making the API documentation more complete and easier to understand.

Previously, the Python APIView would only display instance variables defined in a class's own docstring. With this change, it now also displays instance variables inherited from parent classes, as long as those parent classes are part of the Azure SDK (specified by the package root namespace).

Implementation

  • Updated _parse_ivars() method in ClassNode to traverse the class hierarchy using __mro__ (Method Resolution Order)
  • Added logic to skip duplicate ivars (if a child class overrides an ivar from a parent)
  • Added comprehensive test case with a child class inheriting from a parent with documented ivars

Example

Before this change, a child class would only show its own ivars:

class ChildClass(ParentClass):
    """Child class
    
    :ivar str child_name: Child-specific property
    """
    # Only shows child_name, not parent ivars

After this change, the child class shows both its own ivars and those inherited from parent classes:

class ChildClass(ParentClass):
    """Child class
    
    :ivar str child_name: Child-specific property
    """
    # Shows both child_name and all parent ivars

Fixes #9160.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [Python APIView] display inherited ivars [Python APIView] Display inherited instance variables May 21, 2025
@Copilot Copilot AI requested a review from swathipil May 21, 2025 06:51
Copilot finished work on behalf of swathipil May 21, 2025 06:51
Copy link

Hi @copilot. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Python APIView] display inherited ivars
2 participants