Generator
provide.foundation.docs.generator
¶
API documentation generator for MkDocs with mkdocstrings.
Classes¶
APIDocGenerator
¶
APIDocGenerator(
src_root: str = "src",
api_dir: str = "api/reference",
skip_patterns: set[str] | None = None,
package_prefix: str | None = None,
min_init_size: int = 100,
show_source: bool = True,
show_inheritance: bool = True,
custom_index_content: str | None = None,
)
Generate API reference documentation for MkDocs.
Initialize the API documentation generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_root
|
str
|
Root directory of source code |
'src'
|
api_dir
|
str
|
Output directory for API docs |
'api/reference'
|
skip_patterns
|
set[str] | None
|
Patterns to skip (e.g., {"test", "pycache"}) |
None
|
package_prefix
|
str | None
|
Package prefix to use (e.g., "flavor" or "provide.foundation") |
None
|
min_init_size
|
int
|
Minimum size for init.py files to include (bytes) |
100
|
show_source
|
bool
|
Whether to show source code links |
True
|
show_inheritance
|
bool
|
Whether to show inheritance information |
True
|
custom_index_content
|
str | None
|
Custom content for the API index page |
None
|
Source code in provide/foundation/docs/generator.py
Functions¶
generate
¶
Generate API documentation files.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with generation statistics |
Source code in provide/foundation/docs/generator.py
generate_index
¶
Generate the API index page.
Source code in provide/foundation/docs/generator.py
generate_module_doc
¶
Generate documentation for a single module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
doc_path
|
Path
|
Path where documentation should be written |
required |
identifier
|
str
|
Module identifier for mkdocstrings |
required |
title
|
str
|
Title for the documentation page |
required |
Source code in provide/foundation/docs/generator.py
generate_navigation
¶
Generate the navigation summary file.
Source code in provide/foundation/docs/generator.py
get_module_identifier
¶
Get the full module identifier for a set of path parts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parts
|
list[str]
|
Module path parts |
required |
Returns:
| Type | Description |
|---|---|
str
|
Full module identifier |
Source code in provide/foundation/docs/generator.py
process_python_file
¶
Process a single Python file for documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Python file to process |
required |
Source code in provide/foundation/docs/generator.py
should_skip
¶
Check if a path should be skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if path should be skipped |
Source code in provide/foundation/docs/generator.py
Functions¶
generate_api_docs
¶
generate_api_docs(
src_root: str = "src",
api_dir: str = "api/reference",
skip_patterns: set[str] | None = None,
package_prefix: str | None = None,
**kwargs: Any
) -> dict[str, Any]
Convenience function to generate API docs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_root
|
str
|
Root directory of source code |
'src'
|
api_dir
|
str
|
Output directory for API docs |
'api/reference'
|
skip_patterns
|
set[str] | None
|
Patterns to skip |
None
|
package_prefix
|
str | None
|
Package prefix to use |
None
|
**kwargs
|
Any
|
Additional arguments passed to APIDocGenerator |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with generation statistics |