Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How should class variables be documented? #612

Open
lagru opened this issue Mar 10, 2025 · 0 comments
Open

How should class variables be documented? #612

lagru opened this issue Mar 10, 2025 · 0 comments

Comments

@lagru
Copy link

lagru commented Mar 10, 2025

I'm currently dealing with the case that I want to document a class variable with numpydoc while hacking on docstub. How would I do that? Concretely

class Foo:
    """Short summary.

    Attributes
    ----------
    my_instance_var : int
    """

    my_class_var = 3

    def __init__(self):
        my_instance_var = 2

Should I add this to the existing "Attributes" section, perhaps typed with typing.ClassVar[int] or int, class variable?

@stefanv suggested that custom sections #202 might be a way to address this as well.

Apologies if I missed an existing discussion or documentation about this; I looked but didn't find one.

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

No branches or pull requests

1 participant