-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Docstring parameter descriptions are somewhat redundant and inconsistent #1421
Comments
A compromise is short description (for REPL) + “for more detail description see :glossary: |
I have a number of times noticed the issue of inconsistent naming of the same variable in different places. So I'm definitely in favor of implementing sphinx glossary. However, I also share @mikofski's point that it would be nice to have a combination. Perhaps for simple stuff like However, for less intuitive variables, such as acronyms, I would prefer a small description. For example, many users might not know what
Then, the range, convention, and a more elaborate description can be provided in the glossary. |
Is anyone currently working on this? If not, I am very interested in taking on this work. I have a few projects running currently though so I might be a bit slow, but I guess since this is unresolved since 2022 we'd be okay with a few months more? 😅 |
Can we convert the "Variables and Symbols" page to a glossary as a first step? I am hesitant to remove the descriptions from docstrings. For those browsing the code, using the command line to look at documentation, or reviewing changes, having AOI spelled out along with "see :term: |
Sounds reasonable to me 👍🏾 |
There are some points to discuss about what we want from this glossary page and how we want to link terms in the documentation. The current variables and symbols page defines function parameters as they appear in the function, e.g. lowercase Questions: If we want to link both instances, and use the parameter values directly as glossary terms, the docstring would need to look something like this: pvlib-python/pvlib/irradiance.py Lines 738 to 739 in a7ba8ea
and then the parameter list could be one of two options: pvlib-python/pvlib/irradiance.py Lines 763 to 767 in a7ba8ea
(note there was no full definition originally for this parameter) My view (on the questions): |
How is this rendered?
Does it appear like this Direct Normal Irradiance ? I think I prefer this style for both text and for parameter descriptions.
Where we have a term in the text, e.g., "direct normal irradiance" in the docstring for |
For me, two primary use cases for the Glossary are:
In a book, a Glossary is basically a dict; in the context of pvlib, the keys are the variable names, and the values are definitions or descriptions. If we did it differently (keys are acronyms of phrases) then I think we'd need to call it something other than Glossary, like "List of terms" |
Correct --- see #2234 and this example function
Sorry, I didn't understand this part... do you mean "differently" with respect to a book? So we list variable names (which are sometimes initialisms/acronyms/abbreviations), and then title the page something other than "glossary"? |
I was trying to say that I think
is a more useful presentation than
|
Thanks for the clarification I will wait for a couple more weigh ins to confirm the plan of action here before I transfer all of the terms from the variables and symbols page over |
Should I keep working on #2234? In its current form, is it in line with what people had in mind? |
I like the Glossary appearance, and the links from docstring to glossary. I wouldn't capitalize "Direct Normal Irradiance". Acronyms are capitalized, but the spelled-out words are only capitalized when they are proper nouns. I'd say, press ahead. |
I like where #2234 is going too. Another idea, which I suggest exploring after a working glossary page is merged: consider using sphinx-hoverxref to make these glossary cross-links even more useful. |
very cool! I will definitely look into that and try it out after we have a working glossary page merged |
Is your feature request related to a problem? Please describe.
Conventions like pvlib's definition of
surface_tilt
andsurface_azimuth
are documented somewhat haphazardly in docstring parameter descriptions. This is objectionable in that it is redundant (same description appears in many places) and inconsistent (not all descriptions are the same for a particular parameter). For example many functions inpvlib.irradiance
have parameter descriptions like this:pvlib-python/pvlib/irradiance.py
Lines 553 to 555 in df1c56e
while some others have this:
pvlib-python/pvlib/irradiance.py
Line 329 in df1c56e
Describe the solution you'd like
I'm proposing we convert the "Variables and Symbols" page into a sphinx glossary. Much like how
:py:func:
links to function definitions, sphinx glossaries allow you to link terms to their definitions using:term:`surface_tilt`
. So a glossary like this:would let all
surface_tilt
docstring parameter descriptions reduce to something like this:Describe alternatives you've considered
The downside I see to extracting and centralizing this information is that the gallery definitions are only immediately accessible in the built sphinx docs, so
help(pvlib.irradiance.klucher)
andpvlib.irradiance.klucher?
will be less useful (or, depending on your viewpoint, less cluttered). So there is an argument to be made that centralizing this information is not a net gain and we should continue including it in the docstrings themselves.Additional context
#1253 is vaguely relevant
The text was updated successfully, but these errors were encountered: