-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[CI] Format python with ruff #3832
base: nightly
Are you sure you want to change the base?
Conversation
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.
The PR title does not conform to the '[<Project>] Title' format. Please update the PR title.
Typical [<Project>] values include:
[stdlib]
— indicates a change to the Mojo standard library code[docs]
— indicates a change to the documentation
It's okay to include multiple labels on a PR that affect multiple areas of work.
Thank you for contributing to Mojo!🔥
You can also use a tool like www.regex101.com to see why your PR title fails to conform. Use ^(Revert ")?(\[\S.*\]\s?)+\s+[a-zA-Z`].*
as the regex to test and Format python with ruff
as the test string.
0f3327f
to
e5cf021
Compare
e5cf021
to
3ba29f0
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.
@keith I think this will cause conflicts for every PR until mojo format
behaves the same. I normally run mojo format ./stdlib/
for example. Are there plans to change mojo format to behave like ruff instead of black formatter?
3ba29f0
to
fba3175
Compare
Ruff is a faster and more modern python formatter. This swaps out using `mojo format` for python with ruff. Signed-off-by: Keith Smiley <[email protected]>
fba3175
to
0439b8e
Compare
@keith the tool having a static config option already sold me on wanting to use it 😄 (although now I read that black formatter also has that, I had no idea). Is there another option to avoid the difference in newline in PR #3822 (file) ? |
I think we might just want to stop |
Just an idea: add a flag that is default mojo only where you can also make mojo format run on any extension e.g. |
Hi! I'm the maintainer 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.
LGTM but you'll need to split this across two PRs since the .pre-commit-config.yaml
isn't managed by Copybara whereas the rest of the files are I believe. Also, in a follow-up PR, can you add Ruff to the contributing docs for formatting Python-related parts to avoid future confusion?
!sync (for testing) |
!sync (testing 2) |
Gentle ping here @keith as pretty much every PR from other contributors keeps modifying the |
https://github.com/modularml/modular/pull/52586 should fix the mblack part |
For context, in #3832 we decided that mblack (aka mojo format) will no longer format non mojo files. The change is trivial fortunately. However, this doesn't solve the problem if formatting mojo cells in notebooks, but that's a problem for the future. MODULAR_ORIG_COMMIT_REV_ID: a28bc715affc0d83bff92b72c7eb313e1f80db96
Ruff is a faster and more modern python formatter. This swaps out using
mojo format
for python with ruff.