Skip to content
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

Add GitHub workflow for check Python file formatting #65482

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

tru
Copy link
Collaborator

@tru tru commented Sep 6, 2023

Using darker which is doing black on diffs, similar to git-clang-format.

Using darker which is doing black on diffs, similar to
git-clang-format.
@tru tru added the infrastructure Bugs about LLVM infrastructure label Sep 6, 2023
@tru tru requested a review from a team as a code owner September 6, 2023 14:02
@EugeneZelenko
Copy link
Contributor

May be this should be part of the build as Clang-format in polly? Same could be done for Python linters (Flake8, PyLint, MyPy).

@tru
Copy link
Collaborator Author

tru commented Sep 6, 2023

May be this should be part of the build as Clang-format in polly? Same could be done for Python linters (Flake8, PyLint, MyPy).

Not sure what you mean. I am not familiar with what polly does? We seldom "build" for python scripts.

@tru
Copy link
Collaborator Author

tru commented Sep 7, 2023

Ping @JDevlieghere as well since lldb has a lot of python.

@EugeneZelenko
Copy link
Contributor

May be this should be part of the build as Clang-format in polly? Same could be done for Python linters (Flake8, PyLint, MyPy).

Not sure what you mean. I am not familiar with what polly does? We seldom "build" for python scripts.

Nothing prevents to run some tools (formatters, linters) over Python source files during build. Sure, relevant rules should be added to CMake files.

@tru
Copy link
Collaborator Author

tru commented Sep 7, 2023

May be this should be part of the build as Clang-format in polly? Same could be done for Python linters (Flake8, PyLint, MyPy).

Not sure what you mean. I am not familiar with what polly does? We seldom "build" for python scripts.

Nothing prevents to run some tools (formatters, linters) over Python source files during build. Sure, relevant rules should be added to CMake files.

That's true of course. But I don't think it will gain us anything here. It's going to be hard to do patch based formatting from CMake. We also need to install the whole toolchain and configure CMake just to run the formatters. So it adds a lot of complexity without a clear gain.

I think we might want to add darker to the pre-commit hook.

@JDevlieghere
Copy link
Member

This is great!

Regarding the discussion about making this part of CMake: I agree with Tobias. We don't do this for clang-format either and I don't really want a build/configure step to modify my source directory. I think a pre-commit hook or workflow makes a lot more sense.

@tru
Copy link
Collaborator Author

tru commented Sep 8, 2023

@tstellar any more objections or can I merge this?

@tstellar
Copy link
Collaborator

tstellar commented Sep 8, 2023

@tru No, this seems fine.

@tru tru merged commit d55ac38 into llvm:main Sep 8, 2023
1 of 2 checks passed
@tru tru deleted the tru/python_formatter branch September 8, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Bugs about LLVM infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants