From f8ca6075fb9bbebedbd6a3d9db8042c203e4f4f3 Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Sat, 28 Feb 2026 19:32:17 +0530 Subject: [PATCH] google styled doc string --- docforge/__init__.py | 90 +++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/docforge/__init__.py b/docforge/__init__.py index eb1b272..751e492 100644 --- a/docforge/__init__.py +++ b/docforge/__init__.py @@ -133,7 +133,7 @@ Models: --- -## Google-Styled Doc-Forge Convention (GSDFC) +# Google-Styled Doc-Forge Convention (GSDFC) GSDFC defines how docstrings must be written so they render correctly in MkDocs and remain machine-parsable by doc-forge and AI tooling. @@ -144,7 +144,7 @@ GSDFC defines how docstrings must be written so they render correctly in MkDocs --- -### General rules +## General rules - Use **Markdown headings** at package and module level. - Use **Google-style structured sections** at class, function, and method level. @@ -155,7 +155,7 @@ GSDFC defines how docstrings must be written so they render correctly in MkDocs --- -### Package docstrings +## Package docstrings - Package docstrings act as the documentation home page. @@ -182,13 +182,13 @@ Example: --- - ## Installation + # Installation pip install foo-bar --- - ## Quick start + # Quick start from foobar import Foo, BarEngine @@ -199,7 +199,7 @@ Example: --- - ## Public API + # Public API Foo Bar @@ -210,7 +210,7 @@ Example: --- -### Module docstrings +## Module docstrings - Module docstrings describe a subsystem. @@ -246,7 +246,7 @@ Example: --- -### Class docstrings +## Class docstrings - Class docstrings define object responsibility, lifecycle, and attributes. @@ -315,7 +315,7 @@ Example: --- -### Function and method docstrings +## Function and method docstrings - Function docstrings define API contracts. @@ -397,16 +397,12 @@ Example: --- -### Property docstrings +## Property docstrings - Properties must document return values. Example: - - class FooContainer: - ''' - Container for Foo objects. - ''' + Property Doc String: @property def foos(self) -> tuple[Foo, ...]: @@ -425,13 +421,13 @@ Example: --- -### Attribute documentation +## Attribute documentation - Document attributes in class docstrings using Attributes:. Example: + Attribute Doc String: - class Bar: ''' Represents a processing stage. @@ -445,56 +441,58 @@ Example: --- -### Notes subsection grouping +## Notes subsection grouping - Group related information using labeled subsections. Example: + Notes Example: - Notes: - **Guarantees:** + Notes: + **Guarantees:** - - deterministic behavior + - deterministic behavior - **Lifecycle:** + **Lifecycle:** - - created during initialization - - reused across executions + - created during initialization + - reused across executions - **Thread safety:** + **Thread safety:** - - safe for concurrent reads + - safe for concurrent reads --- -### Example formatting +## Example formatting - Use indentation for examples. -Single example: +Example: + Single example: - Example: - - foo = Foo("example") - process(foo, multiplier=2) - -Multiple examples: - - Example: - Create foo: + Example: foo = Foo("example") + process(foo, multiplier=2) - Run engine: + Multiple examples: - engine = BarEngine([foo]) - engine.run() + Example: + Create foo: + + foo = Foo("example") + + Run engine: + + engine = BarEngine([foo]) + engine.run() Avoid fenced code blocks inside structured sections. --- -### Separator rules +## Separator rules Use horizontal separators only at docstring root level to separate sections: @@ -510,7 +508,7 @@ Do not use separators inside code sections. --- -### Parsing guarantees +## Parsing guarantees GSDFC ensures doc-forge can deterministically extract: @@ -530,11 +528,9 @@ This enables: --- -## Notes - -doc-forge never executes analyzed modules. - -Documentation is generated entirely through static analysis. +Notes: + - doc-forge never executes analyzed modules. + - Documentation is generated entirely through static analysis. """ from .loaders import GriffeLoader, discover_module_paths