-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
simplify requires_files list creation #29656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
simplify requires_files list creation #29656
Conversation
|
👋 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 You ask your reviewers to trigger select CI tests on top of 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 If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
There was a problem hiding this 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.
tests/test_use_existing_torch.py
Outdated
| # Simplified approach (current implementation) | ||
| requires_files_simplified = glob.glob("requirements/*.txt") + ["pyproject.toml"] | ||
|
|
||
| assert requires_files_original == requires_files_simplified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| assert requires_files_original == requires_files_simplified | |
| assert set(requires_files_original) == set(requires_files_simplified) |
Signed-off-by: Chukwuma Nwaugha <[email protected]>
Purpose
Simplify requires_files list creation in
use_existing_torch.pyInstead of this:
We now have this:
Test Plan
python -c "import glob; files = glob.glob('requirements/*.txt') + ['pyproject.toml']; print('Files to process:'); [print(f' {f}') for f in files]"
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