-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[Lint] Add python/sglang to ruff F401 checks and remove unused imports in files
#11685
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
Conversation
Summary of ChangesHello @CatherineSue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the project's code quality and maintainability by refining the linting process. It integrates more comprehensive Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| import torch | ||
| import torch.fx as fx | ||
|
|
||
| import sglang.srt.compilation.weak_ref_tensor_jit |
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.
Not sure about this one.
|
|
||
|
|
||
| if is_mla_preprocess_enabled(): | ||
| import sgl_kernel_npu |
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.
Not sure about this one.
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.
we need to keep this
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.
Added back in 17b44c5
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 is a great step towards improving code quality by enabling more ruff checks (F401 for unused imports and F821 for undefined names) across the python/sglang directory and cleaning up existing unused imports. The changes are extensive but mostly automated, which is good.
I've made a few suggestions to improve the clarity and maintainability of how noqa comments are used to suppress F401 warnings. Specifically, I've pointed out cases where blanket noqa comments on multi-line imports can be ambiguous and where single-line imports would be more readable.
Overall, this is a valuable cleanup effort. Thank you for this contribution!
- F821: missing imports - Exclude all __init__.py
# Conflicts: # python/sglang/srt/disaggregation/decode.py # python/sglang/srt/disaggregation/prefill.py # python/sglang/srt/model_executor/npu_graph_runner.py
- Comes from merge conflicts
63d21ce to
1f0fa29
Compare
|
Will take alook at the CI failures |
|
Execute Notebooks is due to github connection issue. unit-test-backend-8-gpu (1): unit-test-deepep-8-gpu: Started a CI rerun. |
|
Keep seeing |
NPU CI has some network issue, we are handle it, you can ignore it first. If this PR break NPU code, we will fix it by ourself. |
|
All NV tests passed: https://github.com/sgl-project/sglang/actions/runs/18605205543?pr=11685 |
Motivation
This PR adds F401 to ruff checks and removes unused imports accross
python/sglang, excluding__init__.py.Modifications
F821to ruff checks - this catches undefined names/missing importspython/sglangto ruff checks, excluded all init.pyAccuracy Tests
Benchmarking and Profiling
Checklist