Generic Context: Documentation
This file defines project-wide documentation strategies, file conventions, and coding/documentation best practices for this repository. All contributors should ensure code, features, and modules are documented according to these standards.
1. Documentation Strategy Overview
Types of Documentation
Markdown docs under
docs/source/for conceptual information, overviews, usage guides, and UI/architecture explanations.API Reference documentation generated using Sphinx (reStructuredText,
index.rst,.rstfor modules/classes), automatically pulled from inline docstrings.Context Files: Every key technical area, domain, or project-specific feature gets its own CONTEXT or GENERIC markdown explainer for background, design rationales, and nuanced guideposts.
Organization
All user-facing features and docs must be discoverable and linked from
docs/source/index.rst.Use relative references and explicit cross-links, for example:
See [Generic Coding Standards](GENERIC_CODING_STANDARDS.md)
Visual aids, diagrams, or extra materials should go in
docs/source/ordocs/source/_static/as appropriate.
2. Building and Evolving Documentation
Every major feature or refactor must include/update context files, usage guides, and index links.
Document revision history is cross-referenced in
CHANGELOG.mdand in doc comments where appropriate.All architecture or UI diagrams must be kept updated after structural changes.
3. Sphinx & API Reference Practices
Sphinx builds API docs: use reStructuredText (
.rst) for module/class documentation;index.rstacts as a top-level table of contents.Docstring Style: Use Google-style docstrings (Napoleon-compatible).
Location: Every public class, function, or module must have a clear docstring. Internal/private APIs may summarize or reference the public interface.
Napoleon Extension:
conf.pymust enable Napoleon to interpret both Google and NumPy style docstrings seamlessly.
4. Context File Patterns
Each major code, UX, or logic domain should have a
CONTEXT_*.mdfile (for project-specifics) orGENERIC_*.md(for general patterns) underdocs/source/context/.Contents to include:
Motivation and background
Key conventions and reasoning
Cross-links to API/reference/entry points
Special cases or explicit deviations from global standards
5. Self-Documenting Code & Organization Patterns
Google-style docstrings for every class, function, and module. Eg:
def foo(x): """ Short summary. Args: x (int): the foo argument Returns: int: description of the return value """
Function & Class Organization
Group related functionality into packages (
src/oci_policy_analysis/[domain]/)Use
__init__.pyin every package. Only expose intended public APIs in__init__.pyto maintain encapsulation.
Public API Control:
Limit
from <module> import *usage; define__all__where appropriate.Keep the top-level
__init__.pydescriptive and minimal, aggregating only canonical APIs.
Imports & Style:
Organize imports logically: stdlib, third-party, intra-repo.
Ease of Navigation:
Maintain clear navigation/routing in Sphinx index and API docs.
Ensure all users can locate how-to guides, references, and rationale docs from the main doc site.
6. Best Practices Summary
Prefer writing for future teammates—document why as well as what/how.
Regularly review and update documentation for correctness after code or UI changes.
Use explicit type hints in code to help auto-generators (Sphinx, IDE help, CI validation).
Document edge cases and limitations at both code and documentation level.
All new code must be accompanied by appropriate documentation and references in relevant context files.
See also: Generic Coding Standards and README.md for further guidance.