chore: Add list_api script (#3341)
<!-- .github/pull_request_template.md --> ## ๐ Description A utility script that can be used for API review/QA purposes ## ๐ Related Issues <!-- Link any related issues here --> ## ๐ Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### โ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## ๐งช Tests - [x] Tests have been added or updated as needed. - [x] All tests are passing (`unittest`, etc.). ## Reviewer Notes **Examples** List all `@flashinfer_api`-decorated APIs (module-level and class methods), grouped by class (or `[Global Functions]` per file), with full multi-line signatures. ### List current API surface ```bash scripts/list_apis.sh ``` ### Signatures only (no paths, no line numbers) ```bash scripts/list_apis.sh -p ``` ### Class methods only (skip module-level functions) ```bash scripts/list_apis.sh -M ``` ### Inspect a single file ```bash scripts/list_apis.sh -p flashinfer/cascade.py ``` ### Run against a git tag / branch / SHA Auto-fetches from `upstream` or `origin` if not present locally; uses a throwaway worktree. ```bash scripts/list_apis.sh --ref v0.6.9 scripts/list_apis.sh --ref main -p ``` ### Diff the API surface between two revisions Use `-d` for stable, byte-identical output so the diff only reflects real API changes. ```bash diff -u \ <(scripts/list_apis.sh -d -p --ref v0.6.9) \ <(scripts/list_apis.sh -d -p) ``` ### Flags | Flag | Effect | |---|---| | `-n`, `--no-lines` | Omit line numbers | | `-p`, `--no-paths` | Omit paths *and* line numbers (signatures-only) | | `-M`, `--methods-only` | Skip module-level functions; only show class methods | | `-d`, `--deterministic` | Stable, diff-friendly output (sorts files; slightly slower) | | `-r`, `--ref REF` | Run against a git revision via temp worktree | | `-h`, `--help` | Show help | <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added a command-line utility to discover and list decorated Python APIs across the codebase. * Preserves full multi-line function signatures and offers output options to hide line numbers or file paths. * Can limit results to class methods and supports scanning a specific repository revision via a temporary checkout. * Includes an option for stable, deterministic ordering of results. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/flashinfer-ai/flashinfer/pull/3341?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
A
Alex Yang committed
209c16ad8f8a663f6e5461a818046478035e9e8d
Parent: af9a724
Committed by GitHub <noreply@github.com>
on 5/21/2026, 5:52:41 AM