From the course: Accelerate DevOps and Software Development with AI: Modern Tools and Workflows for Enhanced Software Delivery

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Coding project: AI-powered docstrings for developers

Coding project: AI-powered docstrings for developers

- Next, let's move to documentation. Documentation is one of the foundations of well-written software. Unfortunately, it also happens to be one of those things that is often overlooked. In our current project, let's use AI to add documentation to our book service class. My prompt says, "Write a short module docstring for this BookService that explains the four methods and includes one usage example." Accept the suggestion. This looks pretty good. I would've ideally liked it to add this description within the BookService class, but this works too. Next, let's move to the individual methods. I'm going to highlight all the methods and then use a prompt that says, "Write clear Google-style docstring for each method. Add precise type hints to the method signature. Use built-in Python types only." You're going to have to go through all of the suggestions and accept the ones that you like, but we'll keep them all for now.…

Contents