Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
dev:python:sphinx:installation [2023/01/02 13:14] – yoann | dev:python:sphinx:installation [2023/10/22 11:24] (Version actuelle) – yoann | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
===== Sphinx : Installation ====== | ===== Sphinx : Installation ====== | ||
- | On active | + | Sphinx utilise Python et make pour construire la documentation: |
+ | <code bash> | ||
+ | sudo apt install build-essential python3 python3-pip python3-venv | ||
+ | </ | ||
+ | |||
+ | Créer et activer | ||
<code bash> | <code bash> | ||
cd my_app | cd my_app | ||
Ligne 12: | Ligne 18: | ||
Le script **sphinx-quickstart** assiste l' | Le script **sphinx-quickstart** assiste l' | ||
+ | Se placer à la racine du projet et lancer la commande **sphinx-quickstart** | ||
<code bash> | <code bash> | ||
sphinx-quickstart | sphinx-quickstart | ||
</ | </ | ||
- | Ici on fait le choix de créer un répertoire docs à la racine du projet | + | Ici on fait le choix de séparer les répertoires source |
+ | Pour plus de clarté, on fait le choix de renommer les répertoires : | ||
+ | * '' | ||
+ | * On crée un sous repertoire dans build pour la documentation. | ||
+ | Il faudra ensuite modifier le fichier Makefile: | ||
+ | |||
+ | <code bash> | ||
+ | mv source doc | ||
+ | mkdir build/doc | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | # Minimal makefile for Sphinx documentation | ||
+ | # | ||
+ | |||
+ | # You can set these variables from the command line, and also | ||
+ | # from the environment for the first two. | ||
+ | SPHINXOPTS | ||
+ | SPHINXBUILD | ||
+ | SOURCEDIR | ||
+ | BUILDDIR | ||
+ | </ | ||
+ | |||
+ | Tester une compilation | ||
+ | <code bash> | ||
+ | make html | ||
+ | </ | ||
+ | |||
+ | ===== Changer le thème ===== | ||
+ | |||
+ | Le thème "Read The Doc" a été téléchargé mais il n'est pas encore utilisé. Modifier le fichier de configuration '' | ||
+ | |||
+ | <code python> | ||
+ | ... | ||
+ | # Utilise le thème Read the Doc | ||
+ | html_theme = ' | ||
+ | </ | ||
+ | |||
+ | Les nombreuses [[https:// | ||
+ | |||
+ | < | ||
+ | Pour écrire la documentation dans une autre langue que l' | ||
+ | </ | ||
+ | |||
+ | <code python> | ||
+ | ... | ||
+ | extensions = [ | ||
+ | ' | ||
+ | ] | ||
+ | </ | ||
===== Références ===== | ===== Références ===== | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// |