Repository navigation
[Bugfix] Scope deprecated CLI argument warnings to the parser that defines them - #59917
Conversation
…fines them On Python < 3.13, FlexibleArgumentParser tracked deprecated actions in a class-level set shared by every parser, so run-batch's deprecated --url was checked whenever `vllm chat` or `vllm complete` parsed their own --url and emitted a spurious "argument 'url' is deprecated" warning. Mark the action itself (mirroring Python 3.13's Action.deprecated) and only check the parser's own actions. Fixes vllm-project#48094 Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Tyler Ma <158780265+TylerMa-debugg@users.noreply.github.com>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
hmellor
left a comment
There was a problem hiding this comment.
Could we just move _deprecated to an instance variable instead of a class variable?
Make `_deprecated` an instance variable instead of marking each action, and share the parser's set with its argument groups. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Tyler Ma <158780265+TylerMa-debugg@users.noreply.github.com>
|
Good call, done in 46a87cd. |
|
/ci run |
…fines them (vllm-project#59917) Signed-off-by: Tyler Ma <158780265+TylerMa-debugg@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>

Overview
Fixes #48094 (also reported earlier as #42852). On Python 3.10–3.12,
vllm chatandvllm completeprint a spuriousargument 'url' is deprecatedwarning on every run, becauserun-batch's deprecated--urlleaks into sibling subcommands.cc @hmellor
Claims
vllm chat/vllm completeno longer warn that their own (valid)--urlis deprecated.vllm run-batch --url ...still warns once).Validation
Python 3.12.3 (WSL2 Ubuntu), editable install with
VLLM_USE_PRECOMPILED=1.New regression test
test_deprecated_arg_scoped_to_subcommand:End-to-end, counting
argument 'url' is deprecatedlines (no server or GPU needed):vllm chat --url http://127.0.0.1:9/v1vllm complete --url http://127.0.0.1:9/v1vllm run-batch -i x.jsonl -o y.jsonl --model facebook/opt-125m --url 1.2.3.4pre-commit run --files <changed files>andpre-commit run --hook-stage manual --files <changed files>(ruff, mypy 3.10–3.13, etc.) pass.Details
Root cause. Below Python 3.13,
FlexibleArgumentParseremulatesadd_argument(..., deprecated=True)by recording the action in_deprecated, a set defined on the class and therefore shared by every parser and subparser.parse_known_argsthen walks that whole set.run-batchmarks its--url(default0.0.0.0) as deprecated viafrontend_kwargs["url"]["deprecated"] = True, and sincevllm/entrypoints/cli/main.pybuilds every subcommand's parser on each invocation, that action is always in the set. Whenchat/completeparse their own--url(defaulthttp://localhost:8000/v1), the value never equals run-batch's default, so the warning fires. (This is also why a grep fordeprecated=Truedoesn't find it.)Fix. Make
_deprecatedan instance variable. It is created at the top of__init__, becauseArgumentParser.__init__already adds argument groups and-h, and_FlexibleArgumentGroupshares its parser's set, because argparse groups don't keep a reference to their container._SubParsersActioncalls each subparser's ownparse_known_args, so a subcommand's deprecated arguments are only checked when that subcommand is parsed. The warning condition (value differs from the default) is unchanged. Python 3.13+ is unaffected since it uses argparse's native support.Prior work. #42854 proposed the same per-instance fix but was auto-closed as stale without a review. No other open PR addresses this issue.
AI-assisted; I reviewed and tested all changes.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)