-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Update style guide to include documenting Attributes #20393
Comments
I'm not sure if this is applicable we have any more attributes than |
Some classes do have important attributes though and there isn't a clear way to document them. Often the attributes refer to the args e.g. |
There are plenty of examples where this could be useful. For example: Line 1374 in d197d03
Also, there is nothing wrong with documenting |
The only problem I’d address is that we have slightly outdated builder for Attributes section than napoleon |
In general I think it would be better if documentation discourages direct use of class Pow(Expr):
def __new__(cls, base, exp):
return Expr.__new__(cls, base, exp)
@property
def base(self):
return self.args[0]
@property
def exp(self):
return self.args[1]
def as_base_exp(self):
return self.base, self.exp We should generally encourage the use of the properties class sqrt(Pow):
def __new__(cls, arg):
return Expr.__new__(cls, arg)
@property
def base(self):
return self.args[0]
@property
def exp(self):
return S.Half If all other code using these classes (including methods of Apart from cases like |
The style guide states "Everything supported by the above processing tools is available for use in the SymPy documentation, but this style guide supersedes any recommendations made in the above documents." I interpret that to mean that you can use anything from numpydoc as long as anything mentioned in the style guide is followed. So, you can add an attributes section if you need to. When we developed the guide we tried to only include things that are specifically different than the guides for sphinx, rst, numpydoc, etc. |
Actually this statement is better "The SymPy Documentation Style Guide provides both the essential elements for writing SymPy documentation as well as any deviations in style we specify relative to these documentation processing tools." So the guide includes essentials and deviations. If you feel repeating the numpydoc attribute section in the style guide is essential, then we could do that. |
Thanks @moorepants It makes sense. I don't feel we should be repeating it then, unless @oscarbenjamin thinks otherwise. I guess then the only issue we have is rendering "Attributes" section properly, as noted by @sylee957 in this comment: #20331 (comment) |
You could add a note in the style guide that links to the numpydoc attributes guide, so people will know what to look for. |
Our style guide currently doesn't have any recommendations regarding documenting class Attributes, it would be good to have that.
We can take inspiration from numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html#documenting-classes
The text was updated successfully, but these errors were encountered: