unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
7.97k stars 869 forks source link

switch to Ruff instead of `flake8` #2195

Closed Borda closed 5 months ago

Borda commented 8 months ago

Is your feature request related to a current problem? Please describe. It would address linting speed, as Ruff is much faster, and eventually extensibility, as Ruff can cover multiple linting packages with almost no performance drop...

Describe proposed solution replace linking with flake8 preserving the same configuration

Additional context

Recently Ruff has become very popular among also mainstream projects for:

VascoSch92 commented 8 months ago

I think it is a super nice ideas. Moreover, Ruff enable rules for optimization, tipying and docstring.

Good look for the person which has to correct all the errors in the first Ruff PR ;-)

Borda commented 8 months ago

@madtoinou I see you added labels, does it mean that it is fine to send a PR? :rabbit:

VascoSch92 commented 8 months ago

To make things clean: a first set of rules should be discussed here. Just my opinion

Borda commented 8 months ago

To make things clean, a first set of rules should be discussed here to make things clean. Just my opinion

I would suggest enabling Ruff with only already used rules by flake8, no additional rules, so have a 1-to-1 switch, and eventually new rules shall be implemented as separate PRs

madtoinou commented 8 months ago

I haven't yet had any issue with the speed of the linting, I don't think that switching is absolutely necessary so further discussing the rules/benefits would be great before opening a PR :)

I label so that the high priority issues can easily be identified, the indication of "PR welcome" is rather when the issue is added to the Darts "Projects" (Kaban board).

EDIT: Ruff looks indeed quite impressing...

Borda commented 8 months ago

Ruff looks indeed quite impressing...

One of the main benefits is fixing, meaning it is able to handle not complex issues instead of developers and when added later to a project it can resolve majority of low hanging issues...

cc: @madtoinou

Borda commented 7 months ago

@madtoinou @VascoSch92 does it mean :green_circle: to go?

VascoSch92 commented 7 months ago

Some considerations:

madtoinou commented 7 months ago

Hi @Borda,

Just had the opportunity to setup ruff for another project, very nice experience, especially the configuration.

The recently released formatting capabilities is definitely a requirement for darts I would say, and now that it's there, I think you can proceed with the PR, we just need to make sure that ruff is properly configured and the changes to the codebase are minimal.

Borda commented 7 months ago
  • If you're considering introducing Ruff, I would recommend starting gradually and then adding rules on a case-by-case basis.

That is for sure have first PR just to get parity with actual linting and anything extra as separate PRs...

VascoSch92 commented 6 months ago

Hey @Borda Is this still a thing? Should I give a try? It should take no so much time ;)

Borda commented 6 months ago

Is this still a thing?

well, I was waiting some kind of approval but here is the the PR #2323 and and then I can continue...

VascoSch92 commented 6 months ago

ah sorry I didn't saw the PR

Borda commented 6 months ago

ah sorry I didn't saw the PR

i created it just today :flamingo: