Docstrings
Understand how to format and write docstrings to ensure your Book is well-documented.
Format
BDK docstrings adhere to Google style formatting:
Docstrings are placed immediately after function, class, or method definitions.
A brief summary that describes the functionality begins the docstring.
The summary is followed by organized sections, separated by blank lines and labeled with headers.
In BDK projects, docstrings are applied to decorated methods and classes.
Supported Sections
The following sections are supported in BDK docstrings, with alternative headers available for labeling flexibility.
1. Arguments and Parameters
Documents the arguments or parameters that a function or class accepts.
Supported Headers: Args, Arguments, Parameters, Params
Example
@procedure("to add two numbers")
def add_numbers(a: int, b: int = 0) -> int:
"""
Adds two numbers together.
Args:
a: The first number.
b: The second number. Defaults to 0.
"""
return a + b2. Return Values
Documents the return value of a function or method.
Supported Headers: Returns
Example
3. Error Handling
Lists any exceptions or errors that a function might raise.
Supported Headers: Raises, Exceptions, Except
Example
4. Instance Attributes
List instance attributes in a class.
Supported Headers: Attributes
Example
5. Code Authors
Attributes the author(s) of the code.
Supported Headers: Author
Example
6. Labels
Defines labeled data associated with a function related to connections.
Supported Headers: Labels
Example
7. OAuth Labels
Describes OAuth labels for classes decorated with the @oauth decorator.
Supported Headers: OAuth Labels
Example
8. OAuth Arguments
Describes OAuth arguments for classes decorated with the @oauth decorator.
Supported Headers: OAuth Arguments
Example
9. Input Concepts
Describes the input concepts for a procedure.
Supported Headers: Input Concepts
Example
10. Output Concepts
Describes the output concepts for a procedure.
Supported Headers: Output Concepts
Example
11. Examples
Outlines usage examples for a procedure.
Supported Headers: Example, Examples, Example [1-5]
Example
Last updated
Was this helpful?
