Documenting python script entry (__name__ == '__main__') using sphinx
Asked Answered
R

1

3

Is there a way, ideally using autodoc, to get sphinx to document a Python script? The section of the script I want documented is the portion protected by:

if __name__ == '__main__':

i.e. the bit that only runs if the module is used as a script instead of being imported.

Rodrigorodrigue answered 11/6, 2015 at 12:6 Comment(1)
I tried putting in a docstring just below the test. I finally 'saw the light' and used the strategy below (function).Rodrigorodrigue
C
4

You should extract the code in that block into a function, with a docstring, and call that function from the block.

Cerated answered 11/6, 2015 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.