Documentation
Documentation & Docstring StandardsLink
Maintaining clear and consistent documentation is a core principle of Sierra‑SDK. This guide walks you through how to document your code using NumPy-style docstrings, and how to generate clean developer documentation using MkDocs and mkdocstrings.
Why Docstrings MatterLink
Sierra‑SDK enforces strict standards around function and class documentation. Every public-facing function, method, and class should use NumPy-style docstrings to:
- Improve code readability.
- Enable automated documentation generation.
- Ensure consistency across all plugins and modules.
Docstring Format: NumPy StyleLink
NumPy-style docstrings are clean, structured, and ideal for static parsing. Below is a canonical example for a function:
Section OrderingLink
Follow this order strictly:
- Short Summary
- Extended Description (optional)
- Parameters
- Returns
- Raises (if applicable)
- Examples (if useful)
- See Also / Notes (optional)
Required FieldsLink
-
Every parameter must include:
-
Name
- Type
- Description
-
Every return value must include:
-
Type
- Description
Common StandardsLink
- Use
list[str]
notList[str]
– always use lowercase generics for modern typing. - Do not use Markdown inside docstrings.
- Start all descriptions with capital letters and end sentences with periods.
MkDocs IntegrationLink
Sierra‑SDK uses mkdocstrings
to render docstrings into clean, searchable documentation pages.
In mkdocs.yml
:
YAML | |
---|---|
Folder LayoutLink
Make sure your repo structure supports autodoc discovery:
Each file should use properly formatted module-level docstrings:
Python | |
---|---|
Best PracticesLink
- Document every public function and class.
- Avoid documenting private methods unless necessary.
- Keep summaries to a single sentence.
- Use imperative voice: “Return X”, not “Returns X”.
Tools to Enforce ComplianceLink
Use Ruff to enforce docstring rules:
Use MyPy to catch undocumented return values or bad type hints.
Example: Documented Invoker Entry PointLink
SummaryLink
Using proper documentation practices ensures:
✅ Clean auto-generated docs ✅ Easier onboarding for contributors ✅ Long-term maintainability
Follow this guide strictly for all official and third-party Sierra‑SDK plugins.