Skip to content

Conversation

@jaredoconnell
Copy link
Contributor

@jaredoconnell jaredoconnell commented Aug 21, 2025

Purpose

The purpose of this PR is to fix a change introduced in #22534
That PR used the pipe operator |, which only supports being used in place of union in Python 3.10 and newer. So this switches the file to use the python 3.9 supported method.

There was no indication that Python 3.9 was officially dropped, and the documentation still lists 3.9 as the minimum version, so this PR makes the code reflect that.

Here is the error that happens if you run the latest release on Python 3.9:

Traceback (most recent call last):
  File "/root/joconnel/vllm/.venv/bin/vllm", line 5, in <module>
    from vllm.entrypoints.cli.main import main
  File "/root/joconnel/vllm/.venv/lib64/python3.9/site-packages/vllm/entrypoints/cli/__init__.py", line 4, in <module>
    from vllm.entrypoints.cli.benchmark.serve import BenchmarkServingSubcommand
  File "/root/joconnel/vllm/.venv/lib64/python3.9/site-packages/vllm/entrypoints/cli/benchmark/serve.py", line 5, in <module>
    from vllm.benchmarks.serve import add_cli_args, main
  File "/root/joconnel/vllm/.venv/lib64/python3.9/site-packages/vllm/benchmarks/serve.py", line 38, in <module>
    from vllm.benchmarks.lib.endpoint_request_func import (
  File "/root/joconnel/vllm/.venv/lib64/python3.9/site-packages/vllm/benchmarks/lib/endpoint_request_func.py", line 21, in <module>
    class RequestFuncInput:
  File "/root/joconnel/vllm/.venv/lib64/python3.9/site-packages/vllm/benchmarks/lib/endpoint_request_func.py", line 31, in RequestFuncInput
    multi_modal_content: Optional[dict | list[dict]] = None
TypeError: unsupported operand type(s) for |: 'type' and 'types.GenericAlias'

Test Plan

Since this is a two-line bug fix, the plan was to run it locally.

Test Result

With this change I was successfully able to run vLLM with Python 3.9.

(Optional) Documentation Update


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

The pipe operator `|` only supports being used in place of union in Python 3.10 and newer. So this switches the file to use the python 3.9 supported method.

Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added the performance Performance-related issues label Aug 21, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes a Python 3.9 compatibility issue by replacing the | type-hinting operator with typing.Union. The change is accurate, minimal, and resolves the TypeError as described. I approve of this change. To be thorough, a repository-wide check for other instances of the | operator would be beneficial to ensure full Python 3.9 support.

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@njhill njhill added bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed labels Aug 21, 2025
@njhill njhill changed the title Fix Python 3.9 Support [BugFix] Fix Python 3.9 Support Aug 21, 2025
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit, otherwise LGTM, thanks for fixing!

Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
@vllm-bot vllm-bot merged commit 3128240 into vllm-project:main Aug 21, 2025
3 of 5 checks passed
djmmoss pushed a commit to djmmoss/vllm that referenced this pull request Aug 21, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Signed-off-by: Duncan Moss <djm.moss@gmail.com>
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Signed-off-by: Xiao Yu <xiao.yu@amd.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Sep 3, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
sducouedic pushed a commit to sducouedic/vllm that referenced this pull request Oct 16, 2025
Signed-off-by: Jared O'Connell <46976761+jaredoconnell@users.noreply.github.com>
Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants