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
Introduce sort-all
Hook for pre-commit
#4052
Conversation
It's not a lot of code maybe it makes sense to build smth for us with slots and all? |
@Poolitzer that's what I was thinking as well, maybe open an issue in Ruff, cause it will get implemented pretty quickly if accepted |
Have already forked :D https://github.com/Bibo-Joshi/sort-all
also a nice idea! would you mind doing that? Things to mention IMO are
If you like the idea in general, I'd like to go ahead with the package that we have so far :) |
@Bibo-Joshi @clot27 points to astral-sh/ruff#1198 in which it's mentioned that isort can do this already. I'll have to check |
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.
Hey! Looks like you edited the (optional) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the additional dependencies for the hooks in sync with the requirements :)
|
PyCQA/isort#2193 also mentions https://pypi.org/project/asort/. Even though that package is even less maintained than sort-all, it worked well on first try and even kept comments. I'll have another look at it in time |
Welp, asort completely deletes the content of |
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.
Looks good to me as a temporary solution. I suggested this package in the ruff issue: astral-sh/ruff#1198 (comment)
I found https://pypi.org/project/sort-all/ and found it really useful for keeping the
__all__
variables sorted.Admittedly, it's not the best maintained package, but the core functionality works fine. One downside is that comments in the list will be removed, but so far this doesn't affect us.
I would indeed hope that something similar can be set up for
__slots__
.