Skip to content

Conversation

@pieterlexis
Copy link
Contributor

@pieterlexis pieterlexis commented Nov 12, 2025

Short description

This enforces proper formatting of all the python files in the repository.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@pieterlexis pieterlexis force-pushed the ci-python-black branch 2 times, most recently from d2473b3 to f8f680e Compare November 12, 2025 13:16
@miodvallat
Copy link
Contributor

Will you update build-scripts/format-code to handle .py files then?

@pieterlexis
Copy link
Contributor Author

pieterlexis commented Nov 12, 2025

Will you update build-scripts/format-code to handle .py files then?

Not yet, but it could :). Although it is specifically for C++.

formatting yourself is as simple as install black through pip and running black $FILENAME

@pieterlexis pieterlexis marked this pull request as ready for review November 12, 2025 13:42
@zeha
Copy link
Collaborator

zeha commented Nov 12, 2025

From my experience with a rather large project, I'd like to offer two unsolicited pieces of advice:

  1. use ruff format - it tends to be faster (but has subtle formatting differences), and maybe you want to use ruff lint too later
  2. use line-length 120 - modern python needs quite some vertical (white)space

a pyproject.toml config would be:

[tool.ruff]
line-length = 120

@pieterlexis pieterlexis changed the title ci: Force python formatting with black ci: Force python formatting with ruff Nov 14, 2025
@pieterlexis
Copy link
Contributor Author

Updated the PR to use ruff (which is indeed fast)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants