Instruction file imported from Anselmoo/mcp-zen-of-docs (
.github/instructions/python-modules.instructions.md). Copyright stays with the author.
Python Module Standards
Every Python module in this project must follow these conventions:
Module Header
"""Module docstring — one-line summary."""
from __future__ import annotations
__all__ = ["PublicClass", "public_function"]
Required in Every Module
from __future__ import annotations— first import after docstring__all__— explicit public API surface- Google-style docstring at module level
Type Annotations
- 100% type-annotated — all function parameters, return types, variables where non-obvious
- Use
| Noneunion syntax (enabled by future annotations), notOptional[X] - Use
pathlib.Path, notstr, for filesystem paths - Use
StrEnummembers, not raw strings, for categorical values
Error Handling
- Use the
ZenDocsErrorcustom exception hierarchy - Never bare
except:orexcept Exception: - Catch specific exceptions
No print()
- Use
structlogorloggingwithrich.logging.RichHandler - Never use
print()for output