Skip to content

Conversation

@gmfrasca
Copy link
Member

@gmfrasca gmfrasca commented Nov 19, 2025

README Generator Script for Components & Pipelines

Adds a script/module to automatically generate standardized README documentation for KFP components and pipelines. The generator creates consistent documentation including overview, parameters, return types, metadata, and usage examples.

The accompanying GitHub Action validates that committed READMEs of any newly contributed or updated components/pipelines match their generated versions, failing PRs if they're out of sync.

Key additions:

  • scripts/generate_readme/ - Main generator script
  • .github/workflows/readme-check.yml - Enforces README sync on PRs

Run: python -m scripts.generate_readme --component components/dev/hello_world

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign humairak for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gmfrasca gmfrasca changed the title Readme generator feat(scripts): Add README Generator script and accompanying README Sync Check Nov 19, 2025
- Prefer value from metadata.yaml but fall back to decorator param
- If both of these don't exist, instead use function name

Signed-off-by: Giulio Frasca <[email protected]>
@@ -0,0 +1,109 @@
name: README Validation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HumairAK suggested this on my metadata validation PR and I thought it was a good idea - can you add a GH workflows file to run the generate_readme unit tests? Maybe all scripts directory unit tests can be run with a single workflow

with open(self.metadata_file, 'r', encoding='utf-8') as f:
yaml_data = yaml.safe_load(f)

# Remove 'ci' field if present

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is ci field removed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# In CI mode, always restore original README; otherwise ask user
if [ "$CI_MODE" = true ]; then
mv "$TARGET_DIR/README.md.backup" "$TARGET_DIR/README.md"
print_warning "Restored original README (CI mode)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmfrasca From the KEP, my understanding is that we should restore the original README and fail the job, prompting contributors to update or regenerate the README file. Could you update to fail the job in this case and update the message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script actually does this - CI_MODE is just to ignore the prompt to overwrite so that CI Checks don't perpetually wait for user input. The script then fails if it hits this if clause on line 116 (exit 1), so i the behavior matches what is specified

uv run python -m scripts.generate_readme --component components/some_category/my_component
"""
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmfrasca Could you also add the category-level README.md index generation as mentioned in the KEP-

Category README.md files act as indices. Each lists the components/pipelines in that category, provides one-line summaries, and links to the corresponding asset directories; these files are generated automatically and kept fresh by the README automation described above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, this looks like it is in the KEP. however, this is already a lengthy review, so i think perhaps we should add a new PR once this one goes in to extend the functionality?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants