-
Notifications
You must be signed in to change notification settings - Fork 7
feat(scripts): Add README Generator script and accompanying README Sync Check #7
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: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
b7b7c25 to
c9c35b8
Compare
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
Signed-off-by: Giulio Frasca <[email protected]>
- 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]>
c9c35b8 to
fdc9901
Compare
| @@ -0,0 +1,109 @@ | |||
| name: README Validation | |||
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is specifically spec'd out in KEP-913 to be removed: https://github.com/kubeflow/community/tree/master/proposals/913-components-repo#standardized-readme-templates
| # 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)" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
| """ | ||
| ) | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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 PRsRun:
python -m scripts.generate_readme --component components/dev/hello_world