DocumentationCodeBonnesPratiques » Historique » Version 11
Daniel Dehennin, 14/12/2012 14:18
La licence en dehors de la docstring
1 | 1 | Emmanuel GARETTE | h1. DocumentationCodeBonnesPratiques |
---|---|---|---|
2 | 1 | Emmanuel GARETTE | |
3 | 1 | Emmanuel GARETTE | h2. Généralité |
4 | 1 | Emmanuel GARETTE | |
5 | 1 | Emmanuel GARETTE | * La documentation technique doit être en anglais. |
6 | 5 | Gérald Schwartzmann | * Elle est placée dans les docstrings du code. |
7 | 1 | Emmanuel GARETTE | |
8 | 1 | Emmanuel GARETTE | h2. Description du module |
9 | 1 | Emmanuel GARETTE | |
10 | 11 | Daniel Dehennin | La docstring du module est placée en haut du fichier juste après la licence du code au format |
11 | 2 | Gwenael Remond | |
12 | 2 | Gwenael Remond | <pre> |
13 | 2 | Gwenael Remond | ########################################################################### |
14 | 2 | Gwenael Remond | # EOLE |
15 | 2 | Gwenael Remond | # Copyright Pole de Competence EOLE (Ministere Education - Academie Dijon) |
16 | 1 | Emmanuel GARETTE | # Licence CeCILL http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html |
17 | 6 | Gérald Schwartzmann | # eole@ac-dijon.fr |
18 | 2 | Gwenael Remond | ########################################################################### |
19 | 2 | Gwenael Remond | </pre> |
20 | 2 | Gwenael Remond | |
21 | 11 | Daniel Dehennin | La docstring doit contenir : |
22 | 1 | Emmanuel GARETTE | * description rapide en une phrase du module ; |
23 | 1 | Emmanuel GARETTE | * description avancée qui explique le rôle du module ; |
24 | 1 | Emmanuel GARETTE | * des exemples simples d'utilisation. |
25 | 1 | Emmanuel GARETTE | |
26 | 1 | Emmanuel GARETTE | Les exemples peuvent être un prompt : |
27 | 1 | Emmanuel GARETTE | |
28 | 1 | Emmanuel GARETTE | <pre> |
29 | 1 | Emmanuel GARETTE | >>> is_locked() |
30 | 1 | Emmanuel GARETTE | True |
31 | 1 | Emmanuel GARETTE | </pre> |
32 | 1 | Emmanuel GARETTE | |
33 | 1 | Emmanuel GARETTE | ou une portion de code : |
34 | 1 | Emmanuel GARETTE | |
35 | 1 | Emmanuel GARETTE | <pre> |
36 | 1 | Emmanuel GARETTE | :: |
37 | 1 | Emmanuel GARETTE | |
38 | 1 | Emmanuel GARETTE | from toto.titi import is_locked |
39 | 1 | Emmanuel GARETTE | |
40 | 1 | Emmanuel GARETTE | toto() |
41 | 1 | Emmanuel GARETTE | is_locked() |
42 | 1 | Emmanuel GARETTE | </pre> |
43 | 1 | Emmanuel GARETTE | |
44 | 1 | Emmanuel GARETTE | h2. Docstring des méthodes |
45 | 1 | Emmanuel GARETTE | |
46 | 3 | Gwenael Remond | Seules les méthodes publiques (qui ne commencent pas par "_") seront mises dans la documentation (mais les méthodes privées sont aussi à documenter). |
47 | 1 | Emmanuel GARETTE | |
48 | 1 | Emmanuel GARETTE | La docstring doit contenir : |
49 | 1 | Emmanuel GARETTE | |
50 | 1 | Emmanuel GARETTE | * description rapide en une phrase de la méthode ; |
51 | 1 | Emmanuel GARETTE | * si nécessaire une description avancée qui explique le rôle du module ; |
52 | 1 | Emmanuel GARETTE | * si nécessaire des exemples simples d'utilisation. |
53 | 1 | Emmanuel GARETTE | * les paramètres de la façon suivante (xxx étant le nom du paramètre et yyyyyy la description) : |
54 | 1 | Emmanuel GARETTE | |
55 | 1 | Emmanuel GARETTE | <pre> |
56 | 1 | Emmanuel GARETTE | :param xxx: yyyyyy |
57 | 1 | Emmanuel GARETTE | </pre> |
58 | 1 | Emmanuel GARETTE | |
59 | 1 | Emmanuel GARETTE | Si nécessaire les valeurs de retour (yyyyyy étant la description) : |
60 | 1 | Emmanuel GARETTE | |
61 | 1 | Emmanuel GARETTE | <pre> |
62 | 1 | Emmanuel GARETTE | :return: yyyyyy |
63 | 1 | Emmanuel GARETTE | </pre> |
64 | 1 | Emmanuel GARETTE | |
65 | 4 | Gwenael Remond | plus d'info sur la syntaxe des docstrings: http://sphinx-doc.org/domains.html#info-field-lists |
66 | 4 | Gwenael Remond | |
67 | 1 | Emmanuel GARETTE | h2. Docstring des classes |
68 | 1 | Emmanuel GARETTE | |
69 | 10 | Gwenael Remond | comme pour la docstring des modules (mais sans la licence) |
70 | 8 | Gwenael Remond | |
71 | 8 | Gwenael Remond | h2. Tips |
72 | 8 | Gwenael Remond | |
73 | 8 | Gwenael Remond | il est possible de faire un lien portant directement sur le redmine de deux manières : |
74 | 8 | Gwenael Remond | |
75 | 8 | Gwenael Remond | <pre> |
76 | 8 | Gwenael Remond | |
77 | 8 | Gwenael Remond | :issue:`410` |
78 | 8 | Gwenael Remond | |
79 | 8 | Gwenael Remond | </pre> |
80 | 8 | Gwenael Remond | |
81 | 8 | Gwenael Remond | est un lien qui porte directement sur la demande 410 |
82 | 8 | Gwenael Remond | |
83 | 8 | Gwenael Remond | et |
84 | 8 | Gwenael Remond | |
85 | 8 | Gwenael Remond | <pre> |
86 | 8 | Gwenael Remond | |
87 | 8 | Gwenael Remond | :eole:`/projects/creole/wiki/Lock24` |
88 | 8 | Gwenael Remond | |
89 | 8 | Gwenael Remond | </pre> |
90 | 8 | Gwenael Remond | |
91 | 8 | Gwenael Remond | qui est simplement un raccourci vers http://dev-eole.ac-dijon.fr/projects/creole/wiki/Lock24 |