-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
python: Update black to 24.4.0 #3545
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
This is because the name of the configuration includes all the matrix variables. We could eventually rework the workflow to not have this every time a version changes, and not have a new "configuration" that will pile up (in the second screenshot) and be orphaned. |
Most of the changes are adding a blank line between the file's docstring and the code, or removing an extra blank between it. There's only like a dozen or so "real" changes in the .py files. |
I continued and made some tests using Versions: Contents of this PR (black 24.3.0) + ruff format: 79 changed files. (includes libgrass_interface_generator) Is the black preview style better? Ruff preview style has way more changes, I didn't bother writing the results down. Some of these changes could be solved once for both formatters, since some of the differences is some missing/extra blank lines around some comments/docstring at the beginning of the files that black 24 didn't fix, or some tabulations in the copyright headers changed to spaces. Most of the other differences are because of comments at the end of a line instead of before a line, which forces unnatural parenthesis to have the comment at the end of the last line. Sometimes I find that ruff made better choices, sometimes black. When the comment at the end of the line isn't a linter instruction (like However, there are still some differences that ruff makes the same choices that were made with the black version before this PR. |
Have to update the PR, applying the changes, since it was waiting too long and the repo had other PRs merged meanwhile |
Updated the new files and set the black version to the 24.4.0 release |
ad01df4
to
0fa593a
Compare
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.
Thanks for the overall update. The config was indeed dated since it was from the beta version times. Yes, notebooks should be formatted too.
The formatting changes indeed improve the formatting in most cases with couple cases being a neutral change for those specific lines. I added the add ref ignore label.
I see that the rebase this morning brought some other changes that happened since the weekend. I'll need to repost the changed files and will need a new approval |
3078152
to
5d54329
Compare
@wenzeslaus Can you reapprove after the single change in wxplot/profile.py change? |
Once merged, PRs that change python code should be brought up to date in order to not have the workflow fail on main, and have the suggestions shown in the PR (if possible). |
5d54329
to
747badf
Compare
The PRs merged yesterday after my rebase didn't have problems with black 24.4 finally. |
747badf
to
4b22c33
Compare
Can we regive it a go? it was approved 5 days ago on a failing CI check, that is fixed and kept updated. |
Updates black to the latest version, in the GitHub Actions workflows and pre-commit config.
Includes formatting for Jupyter notebooks too, since it is supported since version 21.8b0.
The specific changes in the configuration are made in different commits:
python/libgrass_interface_generator/
. In addition of common exclusions, black excludes all paths listed in.gitignore
. The way the setting was made looks like an older suggested config. We are now aligned with the current recommendations.The files are formatted with the new version in the last commits, the next-to-last commit is for all files in the repo (171 files changed), and the last commit for the 9 Jupyter notebooks that had changes. I separated them for easier review (for looking at only one file at a time).