-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT add isort to ruff's rules #26649
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
Conversation
Linting PassedAll linting checks passed. Your pull request is in excellent shape! ☀️ |
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.
We only need to wait that the linter CI pass.
LGTM then.
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.
Thank you, @adrinjalali.
This LGTM given that:
- we provide guidance to contributors regarding resolving conflicts in their PRs ; e.g. by updating How to fix merge conflicts related to the black code style reformatting of the scikit-learn code base #20301
- we agree on adding the merge commit to
.git-blame-ignore-revs
in a follow-up PR - the CI passes
PS: I like the new bot; kudos to the people who configured 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.
Finally !
@jjerphan hopefully not many people would have issues since this is limited to the imports section, but we can work on the docs if issues arise. |
Came here while dealing with conflicts that I think are due to isort. In particular what happened is that code like this: from sklearn.preprocessing import (
Binarizer,
KernelCenterer,
MaxAbsScaler,
MinMaxScaler,
Normalizer,
PowerTransformer,
QuantileTransformer,
RobustScaler,
StandardScaler,
add_dummy_feature,
maxabs_scale,
minmax_scale,
normalize,
power_transform,
quantile_transform,
robust_scale,
scale,
) has turned into the following: from sklearn.preprocessing import Binarizer
from sklearn.preprocessing import KernelCenterer
from sklearn.preprocessing import Normalizer
from sklearn.preprocessing import normalize
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import scale
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import minmax_scale
from sklearn.preprocessing import QuantileTransformer
from sklearn.preprocessing import quantile_transform
from sklearn.preprocessing import MaxAbsScaler
from sklearn.preprocessing import maxabs_scale
from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing import robust_scale
from sklearn.preprocessing import add_dummy_feature
from sklearn.preprocessing import PowerTransformer
from sklearn.preprocessing import power_transform
from sklearn.preprocessing._data import _handle_zeros_in_scale
from sklearn.preprocessing._data import BOUNDS_THRESHOLD
from sklearn.metrics.pairwise import linear_kernel Is this expected? From the diff/example in the original issue #22853 it looked like these "grouped imports" (better name?) would be preserved. I have two issues with this:
For (1): is there a tool I can use? Can I somehow accept both changes and then run For (2) are there config options we can use (and debate endlessly ;) ) that influence how isort does its business? I can't make a rational argument for why I prefer the "pre isort" style, but aesthetically I find it much more pleasing and "normal". |
Accepting both incoming and current and then running |
To me, the reasoning is the same as we had for black. Some people prefer black formatting, some people prefer another formatting convention. In the end, aesthetic doesn't really matter here. The goal is just that we don't have to think about it. |
Thanks for the tip for (1). Grumpy man Tim says "I've never had to think about imports until today" - back to productive work now instead of arguing on the internet :D |
cc @scikit-learn/core-devs
closes #22853
Now that we have
ruff
and the bot, we can enable isort rules inruff
. This PR does that. Would be nice to mere this quick so that we minimize merge conflicts.