Skip to content

Clean-up + add hygiene checks#463

Open
puneetmatharu wants to merge 12 commits into
ARM-software:mainfrom
puneetmatharu:add-hygiene-checks
Open

Clean-up + add hygiene checks#463
puneetmatharu wants to merge 12 commits into
ARM-software:mainfrom
puneetmatharu:add-hygiene-checks

Conversation

@puneetmatharu
Copy link
Copy Markdown
Contributor

@puneetmatharu puneetmatharu commented Jun 1, 2026

PR Summary

Adds a new hygiene CI workflow and expands pre-commit coverage.

  • Adds .github/workflows/hygiene.yml to run changed-file pre-commit hooks, safe whole-repo hygiene checks, whole-repo reuse lint.
  • Extends .pre-commit-config.yaml with EOF, line-ending, JSON/YAML, case/symlink, large-file, executable/shebang, and ruff-check hooks, with comments for non-obvious behavior.
  • Updates PyTorch and TensorFlow Dockerfiles to avoid pip/uv cache directories in final images.
  • Fixes current ruff findings in PyTorch/TensorFlow examples.
  • Applies hygiene fixes; trailing whitespace/final newline cleanup and refreshed REUSE sidecar metadata.

Note

I propose that we hold off until #458 is merged before we consider merging this. We could potentially even wait until after the 26.06 release.

@puneetmatharu puneetmatharu changed the title Add hygiene checks Clean-up + add hygiene checks Jun 2, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can't work out what has changed here, but as far as I can tell, I think this file can go. There are no references to it in any script, and we don't include any other MLPerf source any more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should just be adding a line ending but it's a huge single line of JSON (not sure why we thought it was the right thing to version control). Happy to wipe this though. Now you've pointed it out, I think there's more files to wipe...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wiped along with a couple of other files


# Install uv for quicker package installations (installed to ~/.local/bin with --user)
RUN python -m pip install --user uv==0.9.29
ENV UV_NO_CACHE=1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand not wanting to cache in the docker build phase to avoid releasing extra blobs, but I think it may be inconvenient for the user to find that uv doesn't cache (given that it is such a useful feature of uv!). Can we instead set this on each run command (or unset at the end of the build)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I'm setting the environment variable during the workshop stage. It should be wiped when we call the second FROM, i.e. when we create the user's workspace. Is there something I'm missing?

python -m pip install --user --no-cache-dir pre-commit==4.5.1 reuse==6.2.0
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Run whole-repo whitespace check
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why can't we just run the whole set in one pre-commit command?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because of the reuse annotate hooks; they should only apply to changed files. Otherwise copyright headers of files that haven't actually been touched will be updated. By itself this shouldn't be a problem since we're not committing files in the CI but it will still cause the hygiene CI to fail (erroneously)

Copy link
Copy Markdown
Contributor

@jondea jondea left a comment

Choose a reason for hiding this comment

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

Generally looks great, thanks! I just had some minor comments.

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