Generate this documentation¶
See Generating the documention with pyquickhelper.
Configuration:
# coding: utf-8
import sys
import os
import alabaster
from pyquickhelper.helpgen.default_conf import set_sphinx_variables
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
set_sphinx_variables(__file__, "python3_module_template", "Xavier Dupré", 2023,
"alabaster", alabaster.get_path(), locals(), add_extensions=['alabaster'],
extlinks=dict(issue=(
'https://github.com/sdpython/python3_module_template/issues/%s',
'issue %s')))
blog_root = "http://www.xavierdupre.fr/app/python3_module_template/helpsphinx/"
notebooks_urls = "http://www.xavierdupre.fr/app/python3_module_template/helpsphinx/notebooks/"
nblinks = {
'slideshowrst': notebooks_urls + 'slide_show.html',
}
epkg_dictionary.update({
'doc': 'http://www.xavierdupre.fr/app/python3_module_template/helpsphinx/index.html',
})
Extensions to install¶
Tips¶
Module pyquickhelper defines sphinx command runpython which generates from a python script included in the documentation itself. The following snippet produces a table.
<<<
from pyquickhelper.pandashelper import df2rst
import pandas
df = pandas.DataFrame([{"x": 3, "y": 4}, {"x": 3.5, "y": 5}])
print(df2rst(df))
>>>
x |
y |
---|---|
3.0 |
4.0 |
3.5 |
5.0 |
The next one is more complex. The code produces titles, label and references. It requires Sphinx engine to be processed.
<<<
rows = []
list_title = ["T1", "T2", "T3"]
back = None
for t in list_title:
rows.append("")
rows.append(".. _l-fake_title-" + t + ":")
rows.append("")
rows.append(t * 3)
rows.append("^" * len(t * 3))
rows.append("")
if back:
rows.append("link :ref:`l-fake_title-" + back + "`")
else:
rows.append("no link")
rows.append("")
back = t
print("\n".join(rows))
>>>
T1T1T1¶
no link
T2T2T2¶
link T1T1T1
T3T3T3¶
link T2T2T2
Raw
.. _l-fake_title-T1:
T1T1T1
^^^^^^
no link
.. _l-fake_title-T2:
T2T2T2
^^^^^^
link :ref:`l-fake_title-T1`
.. _l-fake_title-T3:
T3T3T3
^^^^^^
link :ref:`l-fake_title-T2`