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: .cursor/rules/dev-loop.mdc
+70
Original file line number
Diff line number
Diff line change
@@ -56,3 +56,73 @@ Use `@git-commits.mdc` for assistance with commit message standards.
56
56
## Development Loop Guidelines
57
57
58
58
If there are any failures at any step due to your edits, fix them before proceeding to the next step.
59
+
60
+
## Python Code Standards
61
+
62
+
### Docstring Guidelines
63
+
64
+
For `src/**/*.py` files, follow these docstring guidelines:
65
+
66
+
1. **Use reStructuredText format** for all docstrings.
67
+
```python
68
+
"""Short description of the function or class.
69
+
70
+
Detailed description using reStructuredText format.
71
+
72
+
Parameters
73
+
----------
74
+
param1 : type
75
+
Description of param1
76
+
param2 : type
77
+
Description of param2
78
+
79
+
Returns
80
+
-------
81
+
type
82
+
Description of return value
83
+
"""
84
+
```
85
+
86
+
2. **Keep the main description on the first line** after the opening `"""`.
87
+
88
+
3. **Use NumPy docstyle** for parameter and return value documentation.
89
+
90
+
### Doctest Guidelines
91
+
92
+
For doctests in `src/**/*.py` files:
93
+
94
+
1. **Use narrative descriptions** for test sections rather than inline comments:
95
+
```python
96
+
"""Example function.
97
+
98
+
Examples
99
+
--------
100
+
Create an instance:
101
+
102
+
>>> obj = ExampleClass()
103
+
104
+
Verify a property:
105
+
106
+
>>> obj.property
107
+
'expected value'
108
+
"""
109
+
```
110
+
111
+
2. **Move complex examples** to dedicated test files at `tests/examples/<path_to_module>/test_<example>.py` if they require elaborate setup or multiple steps.
112
+
113
+
3. **Utilize pytest fixtures** via `doctest_namespace` for more complex test scenarios:
114
+
```python
115
+
"""Example with fixture.
116
+
117
+
Examples
118
+
--------
119
+
>>> # doctest_namespace contains all pytest fixtures from conftest.py
0 commit comments