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

Update apply-formatting.yml #520

Merged
merged 25 commits into from
Jun 15, 2021
Merged

Conversation

JoshuaSBrown
Copy link
Collaborator

@JoshuaSBrown JoshuaSBrown commented May 13, 2021

PR Summary

Adding formatting capability to python source files. Parthenon now makes use of several python scripts. It makes sense to expand automatic formatting to the python files. This is achieved in this pr by editing the formatting files that @AndrewGaspar implemented.

Now the ci will both look at python files and cpp files and run a pass or fail check. The par-hermes trigger can also be called as before. Which will auto format the python files in the repository.

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • CI has been triggered on Darwin for performance regression tests.
  • (@lanl.gov employees) Update copyright on changed files

@JoshuaSBrown
Copy link
Collaborator Author

@par-hermes format

@JoshuaSBrown
Copy link
Collaborator Author

@par-hermes format

@JoshuaSBrown
Copy link
Collaborator Author

@par-hermes format

@JoshuaSBrown JoshuaSBrown changed the title Update apply-formatting.yml [WIP] Update apply-formatting.yml May 14, 2021
@JoshuaSBrown
Copy link
Collaborator Author

@par-hermes format

@JoshuaSBrown JoshuaSBrown changed the title [WIP] Update apply-formatting.yml Update apply-formatting.yml Jun 9, 2021
@JoshuaSBrown JoshuaSBrown changed the base branch from JoshuaSBrown/python-formatter to develop June 9, 2021 21:42
@JoshuaSBrown
Copy link
Collaborator Author

I don't think the Check C++ Formatting action is going to run for this pr because I have changed it.

@Yurlungur
Copy link
Collaborator

Nice! What about a command for local formatting? I.e., can we run make format to format the python scripts?

@JoshuaSBrown
Copy link
Collaborator Author

Nice! What about a command for local formatting? I.e., can we run make format to format the python scripts?

Ya, I got lazy. Lol.

@Yurlungur
Copy link
Collaborator

Nice! What about a command for local formatting? I.e., can we run make format to format the python scripts?

Ya, I got lazy. Lol.

I vastly prefer doing local formatting over calling par-hermes, because I'm old-school and I like CLI's I guess. :P

@JoshuaSBrown
Copy link
Collaborator Author

Nice! What about a command for local formatting? I.e., can we run make format to format the python scripts?

Ya, I got lazy. Lol.

I vastly prefer doing local formatting over calling par-hermes, because I'm old-school and I like CLI's I guess. :P

Making me earn my pay. :)

Copy link
Collaborator

@jlippuner jlippuner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition and I agree that we need automated formatting for Python code. I do agree that it would be nice to have local formatting of the Python code (like make format), although I don't consider it absolutely necessary. After all, we mostly work on the C++ code and the Python code doesn't change that often (and there isn't that much to begin with). So if it turns out be a huge pain to implement local Python formatting, I'd be ok to forgo it, provided that par-hermes works.

One more thing, this PR changes a lot of .py files, but it looks like just formatting. Did you make any code changes to any .py files? If so, I think we should have separate PRs for code and infrastructure changes and then all the formatting changes in another PR. But if all the changes to the Python files in this PR are purely formatting, then I think it's ok to have them in this PR.

CONTRIBUTING.md Outdated Show resolved Hide resolved
@JoshuaSBrown JoshuaSBrown added the enhancement New feature or request label Jun 14, 2021
Joshua S Brown and others added 3 commits June 14, 2021 11:16
Co-authored-by: Jonas Lippuner <jlippuner@lanl.gov>
@JoshuaSBrown
Copy link
Collaborator Author

This is a great addition and I agree that we need automated formatting for Python code. I do agree that it would be nice to have local formatting of the Python code (like make format), although I don't consider it absolutely necessary. After all, we mostly work on the C++ code and the Python code doesn't change that often (and there isn't that much to begin with). So if it turns out be a huge pain to implement local Python formatting, I'd be ok to forgo it, provided that par-hermes works.

One more thing, this PR changes a lot of .py files, but it looks like just formatting. Did you make any code changes to any .py files? If so, I think we should have separate PRs for code and infrastructure changes and then all the formatting changes in another PR. But if all the changes to the Python files in this PR are purely formatting, then I think it's ok to have them in this PR.

No I did not change any py files, changes made are only to build configuration and ci.

@JoshuaSBrown
Copy link
Collaborator Author

Nice! What about a command for local formatting? I.e., can we run make format to format the python scripts?

Ya, I got lazy. Lol.

I vastly prefer doing local formatting over calling par-hermes, because I'm old-school and I like CLI's I guess. :P

You should be happy now.

Copy link
Collaborator

@pgrete pgrete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I also confirmed that make format locally works as expected!
Pending my minor comments I'm happy to see this going in.
Also, as next step, we could also consider adding a flake8 step.

cmake/Format.cmake Outdated Show resolved Hide resolved
cmake/Format.cmake Outdated Show resolved Hide resolved
cmake/Format.cmake Outdated Show resolved Hide resolved
Co-authored-by: Philipp Grete <gretephi@msu.edu>
@JoshuaSBrown
Copy link
Collaborator Author

Thanks everyone for the input.

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks, @JoshuaSBrown !

@JoshuaSBrown JoshuaSBrown merged commit 80a62ba into develop Jun 15, 2021
@JoshuaSBrown JoshuaSBrown deleted the JoshuaSBrown/python-formatting branch June 15, 2021 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants