-
Notifications
You must be signed in to change notification settings - Fork 139
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
Add option to allow overriding isort's skip_gitignore option #130
Conversation
@gschaffner thanks for this PR!! ✨ First, sorry for the delay on the response! 😱 I've been rather busy these last days 🤷🏾 Wow! this measurements are really astonishing! From 50s to 5s! 🐎 I'm a bit hesitant on adding the option though 🤔 There are quite a few issues/PR that ask for other settings, and I'm not quite happy of adding all that complexity, this plugin is mostly gluing So, I would rather say that rather than adding the option, we always use this option right away... is there any reason not to do so? 🤔 Another interesting point that you bring is isort 4 and isort 5. I see that there are pre-releases for a version 6 of isort, and last release of isort 4 is June 2019. Maybe it is time to make a breaking release of I'm not asking you to do that 😄 your PR is mostly fine 👍🏾 as said, I would remove the option if there is really no good reason to keep it. The other changes I will take care myself (although I'm happy to review other PRs adding the changes mentioned above 😄 ). Again, sorry for the delay on this review! 🙇🏾 |
hi!
the speedup from this option changes a bit when using isort 5.11, which was released yesterday:
this is likely largely due to PyCQA/isort#1900. so while the speedup is not as drastic when used with isort >= 5.11,
I absolutely agree with you in general here. however, this particular option causes flake8-isort to behave differently than isort, so users can't always put
having this option as always enabled (or as enabled by default) would cause flake8-isort to, by default, behave differently than I think that anything that causes flake8-isort to behave differently than isort should probably not be enabled by default. most users probably assume that making the option opt-in rather than always-on or opt-out means that it will not be enabled unless developers first read the documentation and take the time to think "yes, I understand that enabling this option means that flake8-isort will report files that forcefully enabling [flake8]
per-file-ignores =
...: I or by duplicating information from their [tool.isort]
extend_skip_glob = [
"...",
] I think forcing users to duplicate config like this is bad for a couple reasons:
and even if users DO duplicate config like this, flake8-isort still couldn't (in all cases) be made to work the way it would if it respected
sorry for the long message :P — let me know if it's confusing or phrased poorly! |
I'm all for this if it makes flake8-isort simpler to maintain :). those people still using isort 4 can just use an older flake8-isort with it. if the packaging config is updated to require |
Thanks for the long answer actually 😄 I can understand much better now the idea behind the change 👍🏾 Nice timing with the isort release 🚀 then I'm even more hesitant to add this option 🤔 Let me explain myself: The idea of adding this option in For that, wouldn't you achieve the same by directly modifying temporary So rather than doing the change through If the intended usage is CI, one could have the option in the configuration, but commented out, and CI, before running As the quote says, the best line of code is the one you don't have to write 😅 My train of thought is: if there is a not so complicated way to get the same effect without having to write more code on |
thanks for the reply!
rather than using
this would only confer the speed benefit when calling flake8 via the CI system (or via another script that temporarily modifies isort's configuration when calling flake8). the speed benefit would not be conferred to developers running flake8 (unless they were forced to run flake8 via a wrapper script that handles the temporary isort changes). another problem with temporarily changing isort's configuration is that CI systems often behave differently when config files have been changed. for example, I work with some CI systems that will check all files if a relevant config has been changed, but if no relevant config has been changed they will take a shortcut to save time and check only changed files (since other files are guaranteed to still pass checks). temporarily changing isort's configuration would break this shortcut and would cause CI times to increase drastically (by more than an order of magnitude in some projects I work on).
absolutely!! but I think adding one line (
in my opinion adding ~30 lines of straightforward code to flake8-isort is much simpler than that whole mess, but at the end of the day it is of course your call :) |
Oh my, my comment went 🗑️ 🤦🏾 Anyway, thanks again for taking the time to explain things ✨ Seems that you are dealing with quite a lot of complexity already, so I would still err on the side of, "that's a too edge case for Let's get that merged then 😄 Would you mind adding a line on |
sorry for the delay!
done. I have also rebased onto |
Thanks for the version bump, though, as I release with |
I was about to release, but given that we dropped isort 4.x support, and that's a breaking change, we might as well add flake8 6.0.0 support so we don't have to make two breaking releases in a row 😅 IMHO making thousands of breaking releases (i.e. setuptools) makes semver not so important anymore, for the consumers at least. Of course setuptools and flake8-isort are two different projects with completely different target audiences and expectations 😄 |
thanks again! BTW, I believe that dropping isort 4.x support will not be a breaking change (since you restricted the isort version in 4d0cdb4). isort 4 users will not be affected by the new release. |
Hi!
I was profiling flake8 and found that ~90% of the runtime was just isort waiting for git subprocesses in order to implement
skip_gitignore = True
. (isort doesn't use libgit2 or anything, it just starts short-lived subprocesses targeting the git binary.)skip_gitignore = True
is not very useful when running flake8-isort since flake8 uses its own ignore list already. This PR adds an option--isort-no-skip-gitignore
that allows users to forceskip_gitignore = False
when running flake8-isort without having to removeskip_gitignore = True
from their isort config.On the library I was profiling,
--isort-no-skip-gitignore
brought the flake8 runtime from ~50 s to ~5 s. Note that this measurement is on a Linux box. On Windows the speedup provided by this option appears to be much larger (apparentlysubprocess
is extremely slow on Windows?). I actually did not finish the measurement on a Windows box because without--isort-no-skip-gitignore
, flake8 was taking > 5 min.Note that
skip_gitignore
was added in isort 5.2, so I added the option toFlake8Isort5
rather thanFlake8IsortBase
.