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

Switch from flake8/yapf to ruff. #65

Merged
merged 6 commits into from
Nov 14, 2023
Merged

Switch from flake8/yapf to ruff. #65

merged 6 commits into from
Nov 14, 2023

Conversation

joaander
Copy link
Member

@joaander joaander commented Nov 8, 2023

Description

Switch from flake8/yapf to ruff.

Motivation and context

Perform more lint checks and format in less time.

How has this been tested?

Local execution:

> python3 -m hoomd_benchmarks --device CPU -N 512
HPMCSphere: 2559.8623817983544
MDPairLJ: 2189.046013747209
MDPairOPP: 1036.055777098816
MDPairTable: 2138.47479700528
MDPairWCA: 13069.845253032205
MicrobenchmarkBoxResize: 185082.36165093468
MicrobenchmarkEmptySimulation: 28272547.35651682
MicrobenchmarkCustomTrigger: 5087505.087505087
MicrobenchmarkCustomUpdater: 8971828.458639871
MicrobenchmarkCustomForce: 15884.61416272199
MicrobenchmarkGetSnapshot: 89285.71428571428
MicrobenchmarkSetSnapshot: 20202.0202020202
GSD: 132714.33995696748
GSDLog: 240664.67753041085
HDF5Log: 5180.70506335837

Checklist:

@joaander joaander requested review from a team, tcmoore3 and pepak13 and removed request for a team November 8, 2023 15:27
Copy link
Member

@tcmoore3 tcmoore3 left a comment

Choose a reason for hiding this comment

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

LGTM.

self.run(self.benchmark_steps)
performance.append(self.get_performance())
if print_verbose_messages:
print(f'.. {performance[-1]} {self.units}')
else:
for i in range(self.repeat):
for _i in range(self.repeat):
Copy link
Member

Choose a reason for hiding this comment

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

Did ruff make this change? If so, should we let a formatter change variable names?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it was one of the unsafe fixes that I explicitly opted into on the command line --unsafe-fixes and then carefully reviewed (https://docs.astral.sh/ruff/rules/unused-loop-control-variable/). Running pre-commit run will not make these changes.

This particular change solves https://docs.astral.sh/ruff/rules/unused-loop-control-variable/. I don't particularly agree with underscore prefixes as a solution to solve unused variables, but when switching to standard tools we are opting into what is considered the "standard" solution.

@joaander joaander merged commit 57cc25e into trunk Nov 14, 2023
2 checks passed
@joaander joaander deleted the ruff branch November 14, 2023 16:32
@joaander joaander restored the ruff branch November 15, 2023 16:56
@joaander joaander deleted the ruff branch December 13, 2023 19:08
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.

2 participants