From 18110a40153097d15015af2d5d2ee73a86c2a9df Mon Sep 17 00:00:00 2001 From: Vincent Roulet Date: Thu, 7 Mar 2024 09:48:06 -0800 Subject: [PATCH] Document how to add Examples and test them in docs. PiperOrigin-RevId: 613615583 --- docs/development.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index 5d34dbc22..9bf44baa6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -32,6 +32,14 @@ build the documentation locally as follows: * `make html-noplot` (faster, skips running examples) +### Running doctest +You can add examples illustrating how to use the functions in docstrings. For +inspiration see the `Examples:` section of the code source of `adam` in +`optax/_src/alias.py`. + +To test locally such examples, run +`python -m doctest -v .py`. + (inclusion_criteria)= ## Inclusion Criteria @@ -43,7 +51,6 @@ To ensure Optax remains a focused and high-quality library, we have specific gui If your algorithm doesn't meet the main package criteria, the {doc}`api/contrib` directory is perfect for sharing innovative work. - #### Design Documents For more complex or involved features, we recommend starting by writing a