Creating Documentation
This guide demonstrates how to determine docs coverage and create documentation for your codebase.
This primarily leverages two APIs:
codebase.ai(...)
for generating docstringsfunction.set_docstring(...)
for modifying them
Determining Documentation Coverage
In order to determine the extent of your documentation coverage, you can iterate through all symbols of interest and count the number of docstrings:
To see your current documentation coverage, you can iterate through all symbols of interest and count the number of docstrings:
Which provides the following output:
Identifying Areas of Low Documentation Coverage
To identify areas of low documentation coverage, you can iterate through all directories and count the number of functions with docstrings.
Directories
here.Which provides the following output:
Leveraging AI for Generating Documentation
For non-trivial codebases, it can be challenging to achieve full documentation coverage.
The most efficient way to edit informative docstrings is to use codebase.ai to generate docstrings, then use the set_docstring method to update the docstring.
Adding Explicit Parameter Names and Types
Alternatively, you can also rely on deterministic string formatting to edit docstrings.
To add “Google-style” parameter names and types to a function docstring, you can use the following code snippet:
Was this page helpful?