add ruff lint rule to remove unused imports via ruff#969
add ruff lint rule to remove unused imports via ruff#969msaroufim merged 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/969
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 9006929 with merge base c0a81f9 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
So for linting feel free to add a new file or folder here and make all the changes you need https://github.com/pytorch/ao/blob/main/ruff.toml It's tricky for us to merge something like this since eveyrone would need to rebase their code |
thank you for the reference. that makes sense. |
|
Ok cool! Can you remove unused imports in files erroring in CI and we can merge this |
3356a2a to
822a79c
Compare
turns out the ruff linter is configured to:
my change is to include a stricter linter rule but only applies to the allowlist, kind of between 1 and 2 |
| run: | | ||
| ruff check . | ||
| - name: Check all Python files for syntax errors (E999) and undefined vars (F821) | ||
| - name: Check *all* Python files for F821, F823, and W191 |
There was a problem hiding this comment.
e999 was deprecated and by default applied
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ruff | ||
| pip install ruff==0.6.8 |
There was a problem hiding this comment.
Rule set changes with versions so this is to avoid sudden breakage if they release a newer version
There was a problem hiding this comment.
@drisspg any preference on this?
Cause btw now locally vs remotely there'll be ruff deviations https://github.com/pytorch/ao/blob/main/dev-requirements.txt#L22
There was a problem hiding this comment.
That's fine; I think we just need to also pin in dev-requirments.txt
I kept it loose since it's a pretty common dependency and didn't want to thrash environments, but pinning is better practice
.github/workflows/ruff_linter.yml
Outdated
| strategy: | ||
| matrix: | ||
| python-version: ["3.9"] | ||
| python-version: ["3.11"] |
There was a problem hiding this comment.
| python-version: ["3.11"] | |
| python-version: ["3.9"] |
4b402fb to
9006929
Compare
remove unused imports via ruff
Uh oh!
There was an error while loading. Please reload this page.