pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.13k stars 145 forks source link

Documenting the variables contained within a function not working or unclear #403

Open NLee-NREL opened 2 years ago

NLee-NREL commented 2 years ago

Expected Behavior

I am trying to build documentation that would show the function and the variables contained in that function in the rendered documentation.

so with this function `def batteries():

"""This function blah blah

Args:
     None

Returns:
       list of returns...
"""

batt_format = pd.read_csv('batt_plant_char_format_v3.csv') 
"""read in battery technology format types"""

`

I would like the documentation to include

def batteries() description

   batt_format = ...
   description

Actual Behavior

however, my documentation only shows the functions, not the variables contained.

def batteries() description

Steps to Reproduce

  1. script a function
  2. add a variable with docstring following
  3. run pdoc

Additional info

kernc commented 2 years ago

Unless the function is some class' __init__ constructor and the variables are attributes set upon self (effectively becoming documented instance variables), this doesn't nor is it customary to work. Function-local variables are implementation details that don't need to be exposed in the docs, yet, with PEP-224 comments, they are still documented for the implementer reading the source.