anntzer / speedoc

sphinx meets pydoc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

speedoc – sphinx meets pydoc

PyPI

Turn docstrings into man pages using Sphinx, and view the result with man.

Installation

python -mpip install git+https://github.com/anntzer/speedoc

Tests can be run with pytest.

Usage

speedoc [--opts ...] obj.to.document

Options are passed as is to python -msphinx. By default, sphinx is invoked as

# $tmpdir1, $tmpdir2 are set up by speedoc.
# -bman: build a man page; -q: quietly
python -msphinx $tmpdir1 $tmpdir2 -bman -q -Dextensions=sphinx.ext.napoleon

with a minimal conf.py that sets man_pages = [("contents", obj_name, "\n", "", "3")]. To use, e.g., numpydoc instead of sphinx.ext.napoleon, call

speedoc -Dextensions=sphinx.ext.autodoc,numpydoc obj.to.document

(With numpydoc≥0.9, it is not necessary anymore to explicitly load autodoc.)

Options to man can be passed by setting the (standard) MANOPT environment variable. For example, justification can be disabled with

MANOPT=--nj speedoc ...

Troubleshooting

Q:Docstrings are rendered terribly!
A:Invalid RST formatting is very common :-(

About

sphinx meets pydoc

License:MIT License


Languages

Language:Python 100.0%