Documenting Code with GenAI
In Part 3 of the book, we will introduce advanced practices from the software development lifecycle (SDLC) when working with ChatGPT, OpenAI API, and GitHub Copilot. Using the five S’s framework introduced in Chapter 4, and prompt engineering techniques introduced in Chapter 8 and Chapter 9, we will see how to productionize our Python applications.
In this chapter, we will introduce docstrings for Python objects, which already has a built-in slash command (i.e., /doc) with GitHub Copilot. We can use this slash command with the vanilla format or extend it with specific docstring requirements. Docstrings are already a feature of most IDEs as a template structure where arguments will be formatted with a fixed style, but the standard template does not include any descriptive information about the function or its parameters beyond their name. GitHub Copilot will usually produce a full docstring for high-quality code.
The topics covered in this...