lightly-ai / lightly

A python library for self-supervised learning on images.
https://docs.lightly.ai/self-supervised-learning/
MIT License
2.83k stars 246 forks source link

style: migrate to `ruff` #1564

Open SauravMaheshkar opened 1 week ago

SauravMaheshkar commented 1 week ago

astral-sh/ruff has emerged as a competitor to the existing linters. It's considerably faster than the current linter pylint viz.

Source: ruff repository

Switching to ruff would enable us to switch to a single tool, as it has drop-in parity with black, isort and support for pylint rules.

Happy to open a PR if interested 😄

References:

philippmwirth commented 1 week ago

Great idea, we already use ruff internally. We'd welcome a PR.

TakshPanchal commented 1 week ago

I would like to contribute.

SauravMaheshkar commented 1 week ago

@TakshPanchal sounds good, LMK if you need any help with the PR

TakshPanchal commented 1 week ago

Currently, isort and black is being used right? So I have to pylintrc as reference config. From docs,

Ruff can be configured through a pyproject.toml, ruff.toml, or .ruff.toml file.

So majorly I have to convert pylintrc with one of these file right?

SauravMaheshkar commented 1 week ago

Currently, isort and black is being used right? So I have to pylintrc as reference config. From docs,

Ruff can be configured through a pyproject.toml, ruff.toml, or .ruff.toml file.

So majorly I have to convert pylintrc with one of these file right?

Yes, and let's stick with one single configuration file, so convert pylintrc to a ruff configuration within pyproject.toml.

Ideally the changes lead to no style changes, i.e. running make lint with ruff leads to no changes in code files.