You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+132Lines changed: 132 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,3 +50,135 @@ __authors__ = ["Your Name"]
50
50
```
51
51
52
52
For files based on existing algorithms from academic papers, include the original authors in the `__credits__` variable at [soogo/\_\_init\_\_.py](soogo/__init__.py).
53
+
54
+
## Documentation standards
55
+
56
+
### Docstring format
57
+
58
+
This project uses **Sphinx-style** docstrings with reStructuredText (reST) markup. All public modules, classes, methods, and functions must have docstrings.
59
+
60
+
#### Module docstrings
61
+
62
+
Every Python module should start with a brief one-line description:
63
+
64
+
```python
65
+
"""Brief description of the module."""
66
+
```
67
+
68
+
#### Class docstrings
69
+
70
+
Classes should document their purpose, attributes, and parameters:
71
+
72
+
```python
73
+
classMyClass:
74
+
"""Brief one-line description.
75
+
76
+
Longer description if needed. Can span multiple paragraphs.
77
+
78
+
:param param1: Description of param1.
79
+
:param param2: Description of param2.
80
+
81
+
.. attribute:: attr1
82
+
83
+
Description of attribute attr1.
84
+
85
+
.. attribute:: attr2
86
+
87
+
Description of attribute attr2.
88
+
89
+
References
90
+
----------
91
+
.. [#] Author. Title. Journal, Year. DOI or URL.
92
+
"""
93
+
```
94
+
95
+
#### Function docstrings
96
+
97
+
Functions should document parameters, return values, and include examples when helpful:
98
+
99
+
```python
100
+
defmy_function(x, y, *, option=None):
101
+
"""Brief one-line description.
102
+
103
+
Longer description if needed. Explain what the function does,
104
+
any important algorithms, or behaviors.
105
+
106
+
:param x: Description of parameter x.
107
+
:param y: Description of parameter y.
108
+
:param option: Description of optional keyword argument.
109
+
The default is None.
110
+
:return: Description of return value.
111
+
112
+
References
113
+
----------
114
+
.. [#] Author. Title. Journal, Year. DOI or URL.
115
+
"""
116
+
```
117
+
118
+
#### Key formatting rules
119
+
120
+
-**Line length**: Docstrings must not exceed 80 characters per line (enforced by Ruff W505)
121
+
-**Parameters**: Use `:param name: description` format
122
+
-**Return values**: Use `:return: description` format
123
+
-**Types**: Can be included inline with params (e.g., `:param int maxeval:`) or use type hints
124
+
-**Attributes**: Use `.. attribute:: name` followed by indented description
125
+
-**References**: Use numbered footnote style with `.. [#]` for academic citations
126
+
-**Math**: Use inline math with `:math:\`expression\``or display math blocks with`.. math::`
0 commit comments