DC001: HasDocstrings
Overview
| Property | Value |
|---|---|
| ID | DC001 |
| Name | HasDocstrings |
| Group | documentation |
| Severity | WARNING |
Description
Checks that the main package __init__.py has a module docstring.
A module docstring provides essential documentation about your package’s purpose and basic usage. It appears in:
- IDE tooltips
help()output- Auto-generated documentation
What it checks
The check looks for a docstring in your package’s __init__.py file:
src/{package_name}/__init__.py(src layout){package_name}/__init__.py(flat layout)
How to fix
Add a docstring at the top of your __init__.py:
"""My Package - A brief description of what it does.
This package provides functionality for X, Y, and Z.
Example:
>>> import my_package
>>> my_package.do_something()
"""
from my_package.core import do_something
__all__ = ["do_something"]Good docstrings
- First line: One-sentence summary
- Blank line after summary
- Extended description (optional)
- Usage examples (optional)
Configuration
Skip this check
[tool.pycmdcheck]
skip = ["DC001"]CLI
pycmdcheck --skip DC001