Skip to content

Switch from yapf/pylint/isort to ruff #874

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

Merged
merged 28 commits into from
Jun 26, 2025
Merged

Conversation

fsschneider
Copy link
Contributor

@fsschneider fsschneider commented Jun 18, 2025

This PR updates our codebase to use ruff for linting and formatting, replacing yapf, pylint, and isort. ruff offers the combined functionality of all three tools while being significantly faster.

Previously, running yapf, pylint, and isort locally took ~1m 16s on my workstation.

pylint algoperf && pylint reference_algorithms && pylint prize_qualification_baselines && pylint submission_runner.py && pylint tests && isort . --check --diff && yapf . --diff --recursive

In contrast, running ruff took ~0.14s on my workstation.

ruff check && ruff format --check  

In GitHub Actions, the improvement is less dramatic due to tool installation times, but I observed roughly a 50% reduction in runtime.

Steps

  • Use ruff in GitHub Actions.
  • Update documentation to use ruff.
  • Ensure that the entire codebase conforms to the new ruff code style.

Copy link

github-actions bot commented Jun 18, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@fsschneider fsschneider self-assigned this Jun 18, 2025
@fsschneider fsschneider marked this pull request as ready for review June 23, 2025 11:30
@fsschneider fsschneider requested a review from a team as a code owner June 23, 2025 11:30
@priyakasimbeg
Copy link
Contributor

priyakasimbeg commented Jun 25, 2025

@fsschneider, sorry, there are some merge conflicts after I merged in the dropout refactoring. Could you help resolve the merge conflicts please? I think we just want to accept incoming changes from the dev branch and then reformat them with ruff.

@fsschneider
Copy link
Contributor Author

@fsschneider, sorry, there are some merge conflicts after I merged in the dropout refactoring. Could you help resolve the merge conflicts please? I think we just want to accept incoming changes from the dev branch and then reformat them with ruff.

I believe I resolved them now.
Do we have any tests for the dropout refactoring? This would ensure that I didn't break anything.

@fsschneider fsschneider mentioned this pull request Jun 25, 2025
12 tasks
@priyakasimbeg
Copy link
Contributor

LGTM!

@priyakasimbeg priyakasimbeg merged commit f2b4feb into mlcommons:dev Jun 26, 2025
15 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants