libreant
libreant copied to clipboard
Sphinx REST api
With this PR we can have HTTP API documentation. However, this requires some little change to the command you use to generate documentation. Please note: just sticking to the current commands does not break anything: you will only miss what I added.
Just tell me how
Here is what you used to do till today:
python setup.py build_sphinx
which is great. If you do it after merging this, you will see
WARNING: sphinxcontrib-httpdomain not installed,you will get no REST API doc
You might want to do pip install -U pip && pip install '.[doc]'
Despite the warning, there is no error: documentation is still built, but the "HTTP API" page is empty.
Do what it says, and your favourite command will produce HTTP API, too.
The theory
The sphinx extension that does all the magic must be installed. You could do it running pip install sphinxdomain-httpcontrib
but that's so unelegant. The right way is specify an "extras set" inside setup.py
; doc
sounds like a good name for it. After that, you can just install it with pip install .[doc]
and everything works. Except that extra set in local directory are only supported in pip >= 7
, which is still not very widespread. So pip install -U pip
will install it; after that, you can install libreant with the doc
extra set.
This will require some small change to readthedocs configuration. This will close #168
Is someone willing to test/merge it? I think this is a coll thing to add to libreant documentation.