Skip to content

Conversation

@nwaughachukwuma
Copy link
Contributor

@nwaughachukwuma nwaughachukwuma commented Nov 28, 2025

Purpose

Simplify requires_files list creation in use_existing_torch.py

Instead of this:

requires_files = glob.glob("requirements/*.txt")
requires_files += ["pyproject.toml"]
for file in requires_files:
...

We now have this:

for file in glob.glob("requirements/*.txt") + ["pyproject.toml"]:
...

Test Plan

python -c "import glob; files = glob.glob('requirements/*.txt') + ['pyproject.toml']; print('Files to process:'); [print(f' {f}') for f in files]"

The test file can be found in tests/test_use_existing_torch.py

Test Result

Files to process:
requirements/rocm.txt
requirements/kv_connectors.txt
requirements/dev.txt
requirements/cuda.txt
requirements/rocm-build.txt
requirements/cpu.txt
requirements/xpu.txt
requirements/rocm-test.txt
requirements/build.txt
requirements/common.txt
requirements/cpu-build.txt
requirements/lint.txt
requirements/tpu.txt
requirements/test.txt
requirements/nightly_torch_test.txt
requirements/docs.txt
pyproject.toml

@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 ask your reviewers to trigger select CI tests on top of fastcheck CI.

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.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@nwaughachukwuma nwaughachukwuma changed the title simplify requires_files list creation and remove the variable simplify requires_files list creation Nov 28, 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 simplifies the code in use_existing_torch.py by creating the list of files to process in a single line within the for loop, and also combines two print statements into one. A new test file is added to verify the equivalence of the list creation logic. The changes are good and improve code conciseness. I've found a potential issue in the new test that could lead to flakiness and suggested a fix.

# Simplified approach (current implementation)
requires_files_simplified = glob.glob("requirements/*.txt") + ["pyproject.toml"]

assert requires_files_original == requires_files_simplified
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The glob.glob() function does not guarantee the order of the returned paths across different platforms or filesystems. This could lead to this test being flaky if the two calls to glob.glob() on lines 17 and 21 return the files in a different order, causing the list comparison to fail. Since the order of files being processed by the script doesn't affect the outcome, you should compare the contents of the lists in an order-independent way. Using sets for comparison is a robust way to achieve this.

Suggested change
assert requires_files_original == requires_files_simplified
assert set(requires_files_original) == set(requires_files_simplified)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants