-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Let pre-commit sort pxd files too #1549
Conversation
In PyCQA#1494, it looks like support for `.pxd` files was added. However, these are currently ignored when running isort in pre-commit because there is `types: [python]`
Use types, not extensions
Hi @timothycrosley - my understanding of From the pre-commit docs
|
Yep! I came to the same conclusion myself as well. This is really unfortunate however, because it makes it impossible for isort to add seamless support for Cython files without introducing a regression on non-extensioned Python files. Looks like there is an open issue to add Or type support: pre-commit/pre-commit#607 |
Ah, I didn't think that was possible, sorry! $ echo '#!/usr/bin/python' > nonext
$ sudo chmod +x nonext
$ identify-cli nonext
["executable", "file", "python", "text"] Looks like we'll have to wait for pre-commit/pre-commit#607 |
Would it work for you to just have |
Thanks for highlighting this area of improvement!
The only problem with that is than it will cause a performance regression and maybe even behave in unexpected ways / break non-Python files. That said I would be amenable to that change if we could find some larger users of isort with pre-commit and then create an additional integration test suite that ran pre-commit against those users repositories and could confirm it didn't cause any issues. I think this would be a long-term win for isorts maintainability overall as well. Void of that, I think the most prudent thing to do would be to update the documentation of pre-commit usage to such using a hook per a file-type as shown in this thread: pre-commit/pre-commit#1436 (comment) Example:
Thanks! ~Timothy |
That's a good idea, have updated accordingly - thanks for this and for your awesome work! |
In #1494, it looks like support for
.pxd
files was added. However, these are currently ignored when running isort in pre-commit because there istypes: [python]