Skip to content
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

An option to hide attribute initial values #607

Open
Maboroshy opened this issue Sep 12, 2023 · 2 comments
Open

An option to hide attribute initial values #607

Maboroshy opened this issue Sep 12, 2023 · 2 comments
Labels
feature New feature or request

Comments

@Maboroshy
Copy link

Maboroshy commented Sep 12, 2023

I'm writing a library that has limited API exposed to a user. Some of the exposed class attributes may be initially set up by functions that are not part of the exposed API or the values can be changed later during init process. Putting such initial values to documentation is useless and even confusing for a user.

I’d like to have an option to disable rendering of attributes initial values. It would be useful if the option could disable rendering class variables values and attribute values set in __init__ separately.

I've considered using google format docstrings that render to a table/list attribute representation without values but the docstrings are not merged for inherited classes which is crucial for my project.

@Maboroshy Maboroshy added the feature New feature or request label Sep 12, 2023
@pawamoy
Copy link
Member

pawamoy commented Sep 13, 2023

In the meantime, here's a workaround that seems to work with mypy too:

class A:
    def __init__(self):
        self.a = 0
        
        self.a: int
        """Hello"""

@Maboroshy
Copy link
Author

Thanks for a tip! I can live with that while waiting the option implementation.

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

No branches or pull requests

2 participants