Sorry, I can't answer you why napoleon behaves so because I'm not an author of the extension.
All I can say is handler for parameter generates "Parameters" as a header. https://github.com/sphinx-doc/sphinx/blob/f63abac2cad2664a8af816017f0f997bae510d14/sphinx/ext/napoleon/docstring.py#L690-L696 On the other hand, handler for attributes does generates no headers. https://github.com/sphinx-doc/sphinx/blob/f63abac2cad2664a8af816017f0f997bae510d14/sphinx/ext/napoleon/docstring.py#L602-L622 Thanks, Takeshi KOMIYA 2019年5月7日(火) 1:28 <[email protected]>: > > Hi, > sorry, but I don't think that's true? For instance, the header "Parameters" > *does* appear in functions and class methods. Plus, in the documentation: > https://github.com/sphinx-contrib/napoleon#docstring > no distinction is made between these two types of headers, so why > the "Attributes" header should be treated differently than "Parameters"? > > Anyway, thanks for your input. > Nicolas > > > On Monday, 6 May 2019 15:03:58 UTC+2, Komiya Takeshi wrote: >> >> Hi Nicolas, >> >> It seems napoleon does not output Attribute headers ever even if >> specified. It seems intended behavior. >> >> Thanks, >> Takeshi KOMIYA >> >> 2019年4月22日(月) 23:33 Nicolas Chopin <[email protected]>: >> > >> > Dear list, >> > I use the napoleon extension to parse my "numpy-style" docstrings. It >> > works great for functions, but for classes, I have the following problem. >> > The "Attributes" section list the attributes (as it should), but the >> > header "Attributes" does not show. For instance, I get this: >> > https://particles-sequential-monte-carlo-in-python.readthedocs.io/en/latest/_autosummary/particles.smoothing.ParticleHistory.html#particles.smoothing.ParticleHistory >> > (shortened url: https://bit.ly/2IyxR1F) >> > >> > where X, A, etc are attributes of this class ParticleHistory. You can >> > click on [source] to see how the class is defined; or more simply see >> > below for a simplified version. >> > Am I doing something wrong? This page: >> > https://sphinxcontrib-napoleon.readthedocs.io/en/latest/ >> > says that Attributes is a supported header. >> > >> > I'm using sphinx 1.8.2 on Ubuntu 18.04. >> > Many thanks in advance >> > Nicolas >> > >> > >> > class History(object): >> > """Stores history. >> > >> > Blah, blah, blah. >> > >> > Attributes >> > ---------- >> > X: list >> > X[t] is the object that represents the N particles at iteration t >> > A: list >> > A[t] is the vector of ancestor indices at time t >> > >> > """ >> > >> > def __init__(self, N): >> > """ >> > Constructor. >> > >> > Parameters >> > ---------- >> > >> > N: int >> > number of particles >> > """ >> > self.N = N >> > >> > >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "sphinx-users" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at https://groups.google.com/group/sphinx-users. >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sphinx-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sphinx-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sphinx-users/b29b0d21-850c-4d6f-9213-5e09dd6e2360%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sphinx-users. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/CAFmkQAMkQo6smSTeM_pWK%2BS3xabH9j%3DM%2BS%3DtxpQxP_pvKyaRuw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
