-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
refactor: move ruff and black from the format file to the pre-commit hooks #724
base: master
Are you sure you want to change the base?
Conversation
I'm a heavy user of the Besides that, I think it's a good idea to have them as well in the pre-commit |
thanks @woile for the feedback, let me advocate a bit for this proposed change before I remove them:
if they are part of the pre-commits what is preventing you from executing them all at once in 5s with
If they are used in actions, why not using the pre-commit actions https://github.com/12rambau/sepal_ui/blob/cbca0af9a09e347261af068a40be06ca93b62c5c/.github/workflows/unit.yml#L15 The advantage that I see are:
the issue for me with the current formatting:
If you are really against it, there is no point to my PR as the main objective is to use one and only config for linting/format operation and make it centralized in the pre-commits-config file. Let me know and feel free to close it (along with the associated issue). |
To be honest, I hesitated to submit the same kind of change, use
Note that in the current state, sometimes you need to perform a In fact I already have a branch with some of those changes (pre-commit changes) and I have a local So I am really interested in this discussion and I would love to contribute my changes too. |
@noirbizarre I agree with your analysis but packaging modification have lots of impact on existing branches and forks so in my experience it's better to work with baby steps like this one instead of 1 single PR that will lead to huge conflicts for everyone else. If you look at the associated issue, it's more or less in the pipe. Maybe we can discuss there with the maintainers and keep things simple in this PR ? |
Hi @12rambau @noirbizarre , sorry for the late reply. I just read through this discussion. I like @noirbizarre 's detailed idea and agree with @12rambau that we should take baby steps. Here are some of my thoughts regarding each point.
Python 3.7 is about to reach its EOL and I think it would still be better if we could lint on each version. It still finds some unexpected errors earlier. This strategy is also applied to many large projects as well.
I'm not sure. I still wish everyone actually ran the test once before they pushed. I'm ok with moving it to push only
The reason of using pre-commit on push is to run the long-running tasks that don't need to be run everytime.
This is awesome 🤩
Just a random idea, should we try nox? But tox is good for me as well |
@woile Would love to hear your thoughts 🙂 |
I am a nox person so I would prefer to use it instead of tox but that 100% personnal though functionalities are more or less the same. As mentioned earlier in the PR, I think baby steps will be safer so maybe @noirbizarre comments could be moved to an issue and we could iterate in other PRs. |
I now face conflicts in most of the files (nothing severe though), anything I should do to move this PR forward ? |
I think we'll need @woile 's feedback on this one |
Description
I ask myself, why using a format script to lint the lib instead of a pre-commit hook ? Looking at the format file, it's only using ruff and black so as they have very nicely design hooks I used them instead.
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testIf you agree with this modification, I'll update the PR/documentation instructions
related to #698