@@ -91,8 +91,6 @@ The following command will run black for you if you do not want to configure you
91
91
a good idea to run this command when you are finished working anyways, as our CI will use this to check that
92
92
the formatting is correct.
93
93
94
- Docstring should be formatted using [ Google Style] ( https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html ) .
95
-
96
94
``` bash
97
95
python make.py format
98
96
```
@@ -101,6 +99,37 @@ In addition to Black, this will sort the imports using [Ruff](https://docs.astra
101
99
your editor to run this, please see [ this link] ( https://docs.astral.sh/ruff/integrations/ ) for more information on
102
100
Ruff integration for your specific editor.
103
101
102
+ Docstring should be formatted using [ Google Style] ( https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html ) .
103
+
104
+ The minium for docstrings is covering all parameters in an ` Args: ` block.
105
+
106
+ ``` python
107
+ Args:
108
+ width (int ): The width of something
109
+ height (int ): The height of something
110
+ title (str , optional): The title of something
111
+ ```
112
+
113
+ * ` Args: ` should be used for all parameters
114
+ * ` Returns: ` can be used if the return value needs additional explanation outside of
115
+ the current docstring. If the return type is already clear from type annotation it
116
+ can be omitted.
117
+ * ` Raises: ` can be used if the function raises exceptions that need to be documented
118
+ * ` Yields: ` can be used if the function is a generator and yields values
119
+ * ` Attributes: ` we should try to avoid and instead document the attributes in the code
120
+ * Types are visible in the api docs. It's not mandatory to include complex types in the
121
+ docstring, however, simpler typing is easy enough to include.
122
+ * Using ` optional ` is a good way to indicate that a parameter is optional.
123
+ * Properties and attribute docs don't need a return type when the return type
124
+ is already clear from type annotation.
125
+
126
+ Attribute docstring in module or class:
127
+
128
+ ``` py
129
+ my_attribute_in_class_or_module: type = value
130
+ """ This is a docstring for the attribute."""
131
+ ```
132
+
104
133
### Typing
105
134
106
135
Arcade is using type hints to help with code readability and maintainability.
@@ -190,7 +219,7 @@ Run the doc build to build the web page files, and host a webserver to preview:
190
219
python make.py serve
191
220
```
192
221
193
- You can now open http://localhost:8000 in your browser to preview the docs.
222
+ You can now open < http://localhost:8000 > in your browser to preview the docs.
194
223
195
224
The ` doc/build/html ` directory will contain the generated website files. When you change source files,
196
225
it will automatically regenerate, and browser tabs will automatically refresh to show your updates.
@@ -214,7 +243,7 @@ Start a local web server to preview the doc:
214
243
python -m http.server -d doc/build/html
215
244
```
216
245
217
- You can now open http://localhost:8000 in your browser to preview the doc.
246
+ You can now open < http://localhost:8000 > in your browser to preview the doc.
218
247
219
248
Be sure to re-run build & refresh to update after making changes!
220
249
0 commit comments