I have classical Python package structure:
bin/
my_script
docs/
my_package/
...
and I create docs with Sphinx.
I would like to take docstring from my_script
automatically. Is there any way to do it?
Why want I to do it? I have usage information in this script and I would like to show it in documentation.
My solution - I don't think it's the best.
I created __init__.py
in bin directory and symlink my_script.py
to my_script
. Into conf.py
(config of sphinx) I added:
sys.path.insert(0, os.path.abspath('..'))
Now I can use automodule:
.. automodule:: bin.my_script
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.