Add workflow and script to auto-generate API docs#208
Merged
1985312383 merged 5 commits intodatawhalechina:mainfrom Apr 1, 2026
Merged
Add workflow and script to auto-generate API docs#2081985312383 merged 5 commits intodatawhalechina:mainfrom
1985312383 merged 5 commits intodatawhalechina:mainfrom
Conversation
Add a GitHub Actions workflow (.github/workflows/api-docs.yml) that runs on pull requests to main when torch_rechub sources or the generator change. The workflow detects source changes, sets up Python, runs config/generate_api_md.py, and commits generated docs (docs/en/api/api.md and docs/zh/api/api.md) back to the PR branch. Add config/generate_api_md.py: a script that walks torch_rechub Python files (excluding __init__.py), extracts functions/classes via the AST, formats signatures and docstrings (with parsing for common sections like Parameters, Returns, Shape, Examples), and emits localized markdown API reference files for English and Chinese.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request / 拉取请求
What does this PR do? / 这个PR做了什么?
Add a GitHub Actions workflow (.github/workflows/api-docs.yml) that runs on pull requests to main when torch_rechub sources or the generator change. The workflow detects source changes, sets up Python, runs config/generate_api_md.py, and commits generated docs (docs/en/api/api.md and docs/zh/api/api.md) back to the PR branch.
Add config/generate_api_md.py: a script that walks torch_rechub Python files (excluding init.py), extracts functions/classes via the AST, formats signatures and docstrings (with parsing for common sections like Parameters, Returns, Shape, Examples), and emits localized markdown API reference files for English and Chinese.
Type of Change / 变更类型
Related Issues / 相关Issues
Fixes #207