google styled doc string
This commit is contained in:
@@ -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.
|
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 **Markdown headings** at package and module level.
|
||||||
- Use **Google-style structured sections** at class, function, and method 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.
|
- Package docstrings act as the documentation home page.
|
||||||
|
|
||||||
@@ -182,13 +182,13 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Installation
|
# Installation
|
||||||
|
|
||||||
pip install foo-bar
|
pip install foo-bar
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Quick start
|
# Quick start
|
||||||
|
|
||||||
from foobar import Foo, BarEngine
|
from foobar import Foo, BarEngine
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Public API
|
# Public API
|
||||||
|
|
||||||
Foo
|
Foo
|
||||||
Bar
|
Bar
|
||||||
@@ -210,7 +210,7 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Module docstrings
|
## Module docstrings
|
||||||
|
|
||||||
- Module docstrings describe a subsystem.
|
- Module docstrings describe a subsystem.
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Class docstrings
|
## Class docstrings
|
||||||
|
|
||||||
- Class docstrings define object responsibility, lifecycle, and attributes.
|
- 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.
|
- Function docstrings define API contracts.
|
||||||
|
|
||||||
@@ -397,16 +397,12 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Property docstrings
|
## Property docstrings
|
||||||
|
|
||||||
- Properties must document return values.
|
- Properties must document return values.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
Property Doc String:
|
||||||
class FooContainer:
|
|
||||||
'''
|
|
||||||
Container for Foo objects.
|
|
||||||
'''
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def foos(self) -> tuple[Foo, ...]:
|
def foos(self) -> tuple[Foo, ...]:
|
||||||
@@ -425,13 +421,13 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Attribute documentation
|
## Attribute documentation
|
||||||
|
|
||||||
- Document attributes in class docstrings using Attributes:.
|
- Document attributes in class docstrings using Attributes:.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
Attribute Doc String:
|
||||||
|
|
||||||
class Bar:
|
|
||||||
'''
|
'''
|
||||||
Represents a processing stage.
|
Represents a processing stage.
|
||||||
|
|
||||||
@@ -445,56 +441,58 @@ Example:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Notes subsection grouping
|
## Notes subsection grouping
|
||||||
|
|
||||||
- Group related information using labeled subsections.
|
- Group related information using labeled subsections.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
Notes Example:
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
**Guarantees:**
|
**Guarantees:**
|
||||||
|
|
||||||
- deterministic behavior
|
- deterministic behavior
|
||||||
|
|
||||||
**Lifecycle:**
|
**Lifecycle:**
|
||||||
|
|
||||||
- created during initialization
|
- created during initialization
|
||||||
- reused across executions
|
- reused across executions
|
||||||
|
|
||||||
**Thread safety:**
|
**Thread safety:**
|
||||||
|
|
||||||
- safe for concurrent reads
|
- safe for concurrent reads
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Example formatting
|
## Example formatting
|
||||||
|
|
||||||
- Use indentation for examples.
|
- Use indentation for examples.
|
||||||
|
|
||||||
Single example:
|
Example:
|
||||||
|
Single example:
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
foo = Foo("example")
|
|
||||||
process(foo, multiplier=2)
|
|
||||||
|
|
||||||
Multiple examples:
|
|
||||||
|
|
||||||
Example:
|
|
||||||
Create foo:
|
|
||||||
|
|
||||||
foo = Foo("example")
|
foo = Foo("example")
|
||||||
|
process(foo, multiplier=2)
|
||||||
|
|
||||||
Run engine:
|
Multiple examples:
|
||||||
|
|
||||||
engine = BarEngine([foo])
|
Example:
|
||||||
engine.run()
|
Create foo:
|
||||||
|
|
||||||
|
foo = Foo("example")
|
||||||
|
|
||||||
|
Run engine:
|
||||||
|
|
||||||
|
engine = BarEngine([foo])
|
||||||
|
engine.run()
|
||||||
|
|
||||||
Avoid fenced code blocks inside structured sections.
|
Avoid fenced code blocks inside structured sections.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Separator rules
|
## Separator rules
|
||||||
|
|
||||||
Use horizontal separators only at docstring root level to separate sections:
|
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:
|
GSDFC ensures doc-forge can deterministically extract:
|
||||||
|
|
||||||
@@ -530,11 +528,9 @@ This enables:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Notes
|
Notes:
|
||||||
|
- doc-forge never executes analyzed modules.
|
||||||
doc-forge never executes analyzed modules.
|
- Documentation is generated entirely through static analysis.
|
||||||
|
|
||||||
Documentation is generated entirely through static analysis.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .loaders import GriffeLoader, discover_module_paths
|
from .loaders import GriffeLoader, discover_module_paths
|
||||||
|
|||||||
Reference in New Issue
Block a user