fix(cli): include inherited field docstrings in get_attr_docs#49821
Open
hclsys wants to merge 1 commit into
Open
fix(cli): include inherited field docstrings in get_attr_docs#49821hclsys wants to merge 1 commit into
hclsys wants to merge 1 commit into
Conversation
get_attr_docs(cls) only AST-parses the source of cls itself, so CLI args inherited from a base dataclass (everything FrontendArgs gets from BaseFrontendArgs, e.g. --chat-template, --lora-modules) appear in `--help` with no documentation. Walk the MRO from base to derived so inherited attribute docstrings are collected, with subclass docstrings taking precedence. Fixes vllm-project#49817. Signed-off-by: Chenglun Hu <chenglunhu@gmail.com>
Open
1 task
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.
Fixes #49817.
get_attr_docs(cls)only AST-parsesinspect.getsource(cls)— the class's own body — so attribute docstrings inherited from a base dataclass are dropped. Butdataclasses.fields()exposes inherited fields, so those args still get registered; the net effect is CLI args like--chat-template/--lora-modules(inherited byFrontendArgsfromBaseFrontendArgs) show up invllm serve --help=Frontendwith no docs.Fix: walk
cls.__mro__base→derived and merge per-class attr docs, so inherited docstrings are picked up and a docstring redefined on a subclass still wins. Classes without retrievable source (e.g.object) are skipped.Test
Added
tests/config/test_config_utils.py::test_get_attr_docs_includes_inherited_fields(base + derived + override) and::test_get_attr_docs_handles_object_in_mro.