fury icon indicating copy to clipboard operation
fury copied to clipboard

[Python] RUFF is not comprehensive enough in code style checking

Open pandalee99 opened this issue 5 months ago • 5 comments

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Version

branch main pr #2339 ci It happened on both mac and Windows

Component(s)

Python

Minimal reproduce step

This issue was discovered in ci: https://github.com/apache/fory/actions/runs/16223977620/job/45811302240?pr=2339

+ xargs -P 5 ruff format
error: Failed to parse python/pyfory/_serialization.pyx:39:39: Expected 'import', found name

It seems that ruff cannot correctly recognize cython, which is considered incorrect here.

What did you expect to see?

I hope to achieve compatibility because I have found a change in #2388

What did you see instead?

Fix codestyle

Anything Else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

pandalee99 avatar Jul 11 '25 16:07 pandalee99

@esafak Hi, could you take a look at this question for me? Perhaps ruff really doesn't support the cython format?

pandalee99 avatar Jul 11 '25 16:07 pandalee99

It seems not! https://github.com/astral-sh/ruff/issues/10250

I apologize for this omission. Should we ignore the cython files for now, or handle them separately as before?

esafak avatar Jul 11 '25 16:07 esafak

It seems not! astral-sh/ruff#10250

I apologize for this omission. Should we ignore the cython files for now, or handle them separately as before?

It seems that the issue of ruff not supporting cython was raised last year, but it still cannot be resolved now. I think even if we temporarily ignore the cython file, we don't know when ruff will support it in the future. This is an unknown wait. If there is no better solution, then the previous code style checking method is also acceptable.

But you haven't done anything wrong either. I believe that any contribution should be encouraged and every proposal is worth considering. I also hope that you will get better and better! :)

pandalee99 avatar Jul 11 '25 16:07 pandalee99

Is it ok if I restore black for cython files after #2406 because the work will get lost if I do it now?

esafak avatar Jul 13 '25 01:07 esafak

Is it ok if I restore black for cython files after #2406 because the work will get lost if I do it now?

Certainly, as you wish.

pandalee99 avatar Jul 13 '25 03:07 pandalee99