newBike
newBike

Reputation: 14992

How to generate html documents from docstring

I have a Python project, and wrote many docstring in functions,

how to convert those docstring into html documentation in one or two steps,

I just want the Sphinx can act as doxygen, just convert all my comments or doctring into html documentation.

I run the sphinx-quickstart under the docs folder

then

> autodoc: automatically insert docstrings from modules (y/n) [n]: y

then modified the conf.py long_term_streaming_monitor/docs/source/conf.py

sys.path.insert(0, os.path.abspath('../../src'))

Because all of my source code are put under long_term_streaming_monitor/src

The generated code is here download

I followed the tutorial, but when I opened the index.html I got nothing, no module and methods listed on the html file link

.
├── docs
│   ├── _build
│   │   ├── doctrees
│   │   └── html
│   │       ├── _sources
│   │       └── _static
│   ├── _static
│   ├── _templates
│   └── html
└── src
    ├── long_term_streaming_monitor
    │   ├── log
    │   ├── scripts
    │   └── tests
    │       └── log
    └── long_term_streaming_monitor_.egg-info

Upvotes: 7

Views: 15807

Answers (1)

markroxor
markroxor

Reputation: 6476

As mentioned in one of the comments you can use sphinx.ext.autodoc

More steps on quickstart here.
Check a example configuration file here
Bonus - you can also integrate Travis with sphinx using travis-sphinx to autogenerate your github pages each time you push a code with new docstrings.

Upvotes: 3

Related Questions