Skip to content

Commit 6606319

Browse files
add details about type hinting to authoring guide (GoogleCloudPlatform#4941)
* add details about type hinting to authoring guide * Update AUTHORING_GUIDE.md Good eyes!! Co-authored-by: Bu Sun Kim <[email protected]> Co-authored-by: Bu Sun Kim <[email protected]>
1 parent bde461f commit 6606319

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

AUTHORING_GUIDE.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,17 @@ Argument types should be documented using Python type annotations as
218218
introduced in [PEP 484](https://www.python.org/dev/peps/pep-0484/). For example:
219219

220220
```py
221-
def hello_world(name: string):
221+
def hello_world(name: str) -> None:
222222
print(f"Hello {name}!")
223223
```
224224

225+
```py
226+
def adder(a: int, b: int) -> int:
227+
return a+b
228+
```
229+
230+
Type hinting is enforced using [`flake8-annotations`](https://pypi.org/project/flake8-annotations/), which is enabled by setting the `enforce_type_hints` variable to `True` in the appropriate `noxfile_config.py`. Type hinting is expected in all new samples, and will gradually be added to all compatible existing samples.
231+
225232
If there is an `Args` section within the function's docstring, consider
226233
documenting the argument types there as well. For example:
227234

0 commit comments

Comments
 (0)