Skip to content

Clean-up + add hygiene checks - #463

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

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

Conversation

@puneetmatharu

@puneetmatharu puneetmatharu commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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
Comment thread ML-Frameworks/pytorch-aarch64/examples/openimages-mlperf.json Outdated

# 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?

Comment thread .github/workflows/hygiene.yml Outdated
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 Author

Choose a reason for hiding this comment

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

Turns out there is a better solution for this (yay!). The idea is to add a custom stage to everything by default (I've gone for manual) then trigger all hooks with that stage when running hooks in the CI. I've updated the PR to this effect.

@jondea jondea left a comment

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.

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

@puneetmatharu
puneetmatharu force-pushed the add-hygiene-checks branch 2 times, most recently from b551afb to cd3f193 Compare June 3, 2026 15:50
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