pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

Documenting the variables contained within a function not working or unclear

Open NLee-NREL opened this issue 3 years ago • 1 comments

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

  • pdoc version: latest

NLee-NREL avatar Jun 09 '22 21:06 NLee-NREL

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.

kernc avatar Jun 09 '22 22:06 kernc