-
Notifications
You must be signed in to change notification settings - Fork 548
Feature/sdk docs from field description #3822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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:
develop
and the open PR is targetingdevelop
. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes