-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add ruff linter #201
Add ruff linter #201
Conversation
/ok to test |
The actions seem to be broken as of a long time ago. The culprit being a faulty build command which looks for setup.py in cuda-python top level directory. I'm wondering if that will be addressed by QA, or if I/someone should fix it. |
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.
I couple of comments:
- Once you're ready, can you try testing the builds and tests across our supported Python versions (3.9 to 3.12) and 3.13? For the bindings just doing 3.9 and 3.13 is probably sufficient(?), just because the build there takes a while. In the past some of my own code formats had issues for certain versions, so some paranoia is creeping in. Surely since this is a linter all of that ought to be ok, but still 🙂.
Would need a follow-up PR into the 11.8.x branch. Just an FYI for when the time comes.Actually no, this shouldn't be necessary since the only change expected on that branch are the bindings which aren't covered by the linter anyways. The only items remaining would be the tests/examples, but that is expected to stay the same.
cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py
Outdated
Show resolved
Hide resolved
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.
Looks good to me, but what do you think about splitting this PR into two parts:
- Add tox testing only.
- Add ruff only with the tox testing in place already.
That would make it easier** to see what changes (if any?) are required to establish tox testing, and what changes are a consequence of introducing ruff.
easier** in the future, in case we have to backtrack for whatever reason.
@vzhurba01 The changes have been verified against python 3.9 and 3.13 successfully. |
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.
Another idea borrowed from pybind11:
This ensures that all PRs pass the pre-commit checks.
I didn't see that here. I'm not sure if you have another way of achieving the same?
431334e
to
28537dd
Compare
Dependencies have been addressed and submitted. |
28537dd
to
5e950f7
Compare
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.
Looks good to me, but question: Do you want to wait merging this PR until after #249 is merged?
Minor: I think there are a couple files missing a newline at the end of the file, which can be annoying. VSCode has these settings: "Files Insert Final Newline", "Files: Trim Final Newlines", "Notebook: Insert Final Newline" that work well for me. I also have "Editor: Render Final Newline: off".
I think in another PR we should add a pre-commit checks for whitespace issues like that one.
yeah, I am not opposed to waiting for #249. I'm wokring on a follow up to 249 that will run the testsuites against different versions of python and cuda as well. I'll look into the newline, I would expect ruff formatter to handle that. |
/ok to test |
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.
Looks good to me. Keenan confirmed on chat that local testing passes for him.
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.
LGTM overall. AI:
- @ksimpson-work could you merge with the latest main and rerun the linter? There are merge conflicts
- @vzhurba01 could you take one more look at cuda.bindings changes?
/ok to test |
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.
I noticed that fixes for some older comments got reverted. Perhaps happened due to a rebase? I unresolved those that I'd like to see re-applied.
Yes that is my bad. Rather than merge, I checked-out main and reran the linter but that reverted soem of the manual changes I forgot about. I believe everything has been addressed now. |
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.
LGTM thank you @ksimpson-work!
Thanks @ksimpson-work and all! Glad this is set up. Let's get this in and follow up in new PRs if needed. |
FYI, I added some basic docs mentioning about |
@@ -2,4 +2,3 @@ | |||
# | |||
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE | |||
|
|||
from cuda.core.experimental._memoryview import StridedMemoryView, viewable |
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.
Add Ruff linter and format to pre-commit-hooks + make the appropriate changes in the code base so that we start with a passing commit.
some per-file ignores have been added, and some globals. I think these can be a work in progress, and I used my best judgement, but I would love to hear feedback.
Depends on #203
The only real bug this exposes is #203 which I am addressing in a separate PR and issue for cleanliness
Closes #195