Feature/sdk docs from field description #3822
   Draft  
   Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.    
 
Describe changes
When docs/mkdocstrings_helper.py runs (during doc generation), it now calls process_pydantic_files_in_directory() first.
def process_pydantic_files_in_directory(directory: Path) -> None:
# Finds all .py files recursively in src/zenml/
# For each file, calls generate_docstring_attributes_from_fields()
def generate_docstring_attributes_from_fields(file_path: Path) -> None:
# Uses Python AST (Abstract Syntax Tree) to parse the source code
# Looks for classes that have Field() definitions
# Extracts the description parameter from each Field()
Before (Current state):
class KubernetesOrchestratorSettings(BaseSettings):
"""Settings for the Kubernetes orchestrator."""
After (Auto-generated during doc build):
class KubernetesOrchestratorSettings(BaseSettings):
"""Settings for the Kubernetes orchestrator.
Key Benefits
Single Source of Truth: Field descriptions remain the authoritative documentation
Build-Time Only: Changes only happen during doc generation, not in the PyPI package
No Maintenance: No manual duplication needed
mkdocstrings Compatible: Generated docstrings work perfectly with existing tooling
Workflow
graph TD
A[Developer adds Field descriptions] --> B[Code committed without docstring attributes]
B --> C[CI runs docs/generate-docs.sh]
C --> D[mkdocstrings_helper.py processes files]
D --> E[Auto-generates docstring attributes from Field descriptions]
E --> F[mkdocs builds SDK docs with visible attributes]
F --> G[SDK docs show both class docs AND field descriptions]
Pre-requisites
Please ensure you have done the following:
developand the open PR is targetingdevelop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes