From 0a46f30680c5bc1f1122721408fc4136264a73d4 Mon Sep 17 00:00:00 2001 From: Steph Merritt <97111051+astronomerritt@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:10:10 +0000 Subject: [PATCH] Update README.md Updating the README to give examples of docstring layout. --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index ab5a148..9b06b93 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,49 @@ If you are adding code that should be run from the command line, this should be adler = "adler.adler:main" my_command = "adler.module_folder.module_name:function_name" ``` + +## Dev Guide - Docstrings + +The docstrings use the numpydoc format. This is the format expected by the LINCC Frameworks template and results +in docstrings which compile neatly and automatically for the docs. + +An example is below. Don't include the Returns section if your code returns nothing. + +``` +"""Here is a function that does some cool sciency stuff. + +- Perhaps you want to add some bullet points. +- You can do that like this! + +Parameters +----------- +arg1 : int + The first argument to the function. +arg2 : str + The second argument to the function. Default = "foo". + +Returns +---------- + +return_value : float + The thing your function returns. + +""" + +``` + +For classes: + +``` +"""A class that contains some important science information. + +Attibutes +----------- +attr1 : int + The first class attribute. + +attr2: np.array + The second class attribute. + +""" +```