flake8-docstrings-complete Now Checks for Duplicate Descriptions

Version v1.1.0 of flake8-docstrings-complete has added new rules that ensure you only document each argument, raised exception and class attribute once:

  • DCO025: function/ method has one or more arguments described in the docstring multiple times.
  • DCO056: function/ method has one or more exceptions described in the docstring multiple times.
  • DCO065: class has one or more attributes described in the docstring multiple times.
Continue reading “flake8-docstrings-complete Now Checks for Duplicate Descriptions”

Writing Great Docstrings in Python

Have you ever tried to understand a new project by looking at the source code only to find that the code isn’t clear on its own and is lacking documentation, such as docstrings? I have had that experience a few times which slowed down being able to fix bugs and add new features and frequently also meant that the code wasn’t well structured. In this post we’ll look at best practices for documenting in code and its numerous benefits such as helping you be clear on what you actually need to code and reminding yourself and others about how the code works when you come back from an extended holiday. We will also look at a linter that checks your docstrings to make sure they are complete. Your future self will then never be frustrated about a lack of documentation in code again!

Continue reading “Writing Great Docstrings in Python”

Writing Great Test Documentation

Have you ever needed to understand a new project and started reading the tests only to find that you have no idea what the tests are doing? Writing great test documentation as you are writing tests will improve your tests and help you and others reading the tests later. We will first look at why test documentation is important both when writing tests and for future readers and then look at a framework that helps give some structure to your test documentation. Next, we will look at a showcase of the flake8-test-docs tool that automates test documentation checks to ensure your documentation is great! Finally, we briefly discuss how this framework would apply in more advanced cases, such as when you are using fixtures or parametrising tests.

Continue reading “Writing Great Test Documentation”

Help your Users fix your Errors

Have you ever encountered an error when using a package and then gone to Google to find out how to solve the error only not to find any clear answers? Wouldn’t you have preferred to go directly to documentation that tells you exactly what went wrong and how to resolve that error? A lot of us can tell similar stories, especially when we try something new. I have also abandoned an otherwise promising package after encountering an error that wasn’t clear or when I didn’t know how to solve the error.

Continue reading “Help your Users fix your Errors”