Skip to content

Conversation

@MarcoGorelli
Copy link
Contributor

I was testing out cython-lint and figured I'd open a PR to see if there was interest

This flags some issues here such as:

  • unused imports
  • unused variables
  • "pointless string statements"
  • f-string without placeholders

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run pre-commit jobs to lint the changes in this PR. (pre-commit setup)
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@MarcoGorelli MarcoGorelli marked this pull request as ready for review October 14, 2025 20:07
@MarcoGorelli MarcoGorelli requested a review from a team as a code owner October 14, 2025 20:07
Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

Looks like a nice addition. Are the changes here all of the errors from enabling the linter?


def function_executor(*arguments, **kwarguments):
function = execution_info.function
function = execution_info.function # no-cython-lint
Copy link
Collaborator

Choose a reason for hiding this comment

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

what needed to be skipped here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because function shadows the globally-imported symbol here:

from libcpp.functional cimport function

We can either turn off the lint of this line, or rename this local function variable. Do you have a preference?

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's rename the local variable to avoid any # no-cython-lint

increase_recursion_limit()

eventloop, async_thread = self.get_event_loop(
eventloop, _async_thread = self.get_event_loop(
Copy link
Collaborator

Choose a reason for hiding this comment

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

is _async_thread unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's right!

Copy link
Collaborator

Choose a reason for hiding this comment

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

to follow convention in the rest of the code, let's just do:

Suggested change
eventloop, _async_thread = self.get_event_loop(
eventloop, _ = self.get_event_loop(

rev: v0.17.0
hooks:
- id: cython-lint
args: [--no-pycodestyle]
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this flag for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pycodestyle runs some more nitpicky lints, like

/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2324:89: E501 line too long (108 > 88 characters)
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2330:5: E303 too many blank lines (2)
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2528:6: E111 indentation is not a multiple of 4
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2528:6: E117 over-indented

so for a first iteration I kept them out

Copy link
Collaborator

Choose a reason for hiding this comment

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

these look good to me too, maybe open a 2nd PR that removes the --no-pycodestyle?

@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core devprod community-contribution Contributed by the community labels Oct 15, 2025
@MarcoGorelli
Copy link
Contributor Author

thanks for your review!

yes, that's right

@MarcoGorelli MarcoGorelli force-pushed the cython-lint branch 2 times, most recently from debd15b to 689d10d Compare October 21, 2025 16:16
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Oct 21, 2025
@edoakes edoakes enabled auto-merge (squash) October 21, 2025 19:56
@edoakes
Copy link
Collaborator

edoakes commented Oct 21, 2025

Triggered CI run and enabled auto-merge. If CI passes the PR will merge. If not, please ping me.

Thanks again for the contribution!

@MarcoGorelli
Copy link
Contributor Author

thanks @edoakes !

If not, please ping me.

looks like it didn't go, should i fetch upstream and rebase?

auto-merge was automatically disabled October 22, 2025 13:08

Head branch was pushed to by a user without write access

Signed-off-by: Marco Gorelli <[email protected]>
@edoakes edoakes merged commit 25758ea into ray-project:master Oct 31, 2025
6 checks passed
YoussefEssDS pushed a commit to YoussefEssDS/ray that referenced this pull request Nov 8, 2025
I was testing out `cython-lint` and figured I'd open a PR to see if
there was interest

This flags some issues here such as:
- unused imports
- unused variables
- "pointless string statements"
- f-string without placeholders

Signed-off-by: Marco Gorelli <[email protected]>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
I was testing out `cython-lint` and figured I'd open a PR to see if
there was interest

This flags some issues here such as:
- unused imports
- unused variables
- "pointless string statements"
- f-string without placeholders

Signed-off-by: Marco Gorelli <[email protected]>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
I was testing out `cython-lint` and figured I'd open a PR to see if
there was interest

This flags some issues here such as:
- unused imports
- unused variables
- "pointless string statements"
- f-string without placeholders

Signed-off-by: Marco Gorelli <[email protected]>
Signed-off-by: Aydin Abiar <[email protected]>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
I was testing out `cython-lint` and figured I'd open a PR to see if
there was interest

This flags some issues here such as:
- unused imports
- unused variables
- "pointless string statements"
- f-string without placeholders

Signed-off-by: Marco Gorelli <[email protected]>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
I was testing out `cython-lint` and figured I'd open a PR to see if
there was interest

This flags some issues here such as:
- unused imports
- unused variables
- "pointless string statements"
- f-string without placeholders

Signed-off-by: Marco Gorelli <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants